i have three files that i should use for a GIS application:
map.aux, map.tfw, map.tif
The .tif file is a "layer" that highlights some building over a map. These files are georeferenced to specific coordinates.
How can i bring these informations (and "image") on a layer of Google Maps? Any idea? Thank you!
I can't give you code since I've never tested, but the following should work:
You can use the ground overlay object coming from Gmaps:
https://developers.google.com/android/reference/com/google/android/gms/maps/model/GroundOverlay
It allows you specify an image in format of "BitmapDescriptor" and eventually anchor and bearing of the given tif.
The good for you is that, if you've already georefenced the file and it is in the default Google Maps projection (900913 or 3857, Mercator) you don't need to rotate data. Just take out the position of the raster from aux/tfw files (there should be a line specifying the topleft coordinate for the raster and the size of it; from those lines you should be able with some math to get the LatLng bounds needed to initialize the groundOverlay.
The only part I'm not sure is easy is to create a BitmapDescriptor from a tiff. If this is not easy or impossible, just reconvert the tif to png, that will possible to read and put in a BitmapDescriptor.
Maybe is not the code for you question, but at least a starting point!
With R you can do
library(raster)
r <- raster('map.tif')
KML(r, 'map.kml')
open the .kml file in Google earth.
See package plotKML for more advanced options
Related
How can we Draw a line away from "google map navigation path" at fixed distance on both the side, so it will create box like view around navigation path. is it possible?
Please check the attached image to be more clear with requirement, where blue line is my navigation path between two point & red line is that suppose to be plot around the path at fix distance
[]
Also I have use 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&type=restaurant&name=cruise&key=Key' to get place list around selected location. But is it possible to get all place detail for whole path, like all the restaurant that are 1KM away from displayed navigation path. is it possible?
For the "box like view around the navigation path", it's possible by using the Google Maps API - Shapes - Polygon. From the doc:
...polygons are designed to define regions within a closed loop with the interior filled in.
You just have to define the points for the outline of the polygon. I think here, you can use the location of the navigation path as center, to be the basis of where you'll put the polygon points.
While for the "is it possible to get all place detail for whole path, like all the restaurant that are 1KM away from displayed navigation path", yes, it's possible. As seen in the sample URL you provided on your post:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&type=restaurant&name=cruise&key=Key
-- you are already defining the radius(500m) and the type(restaurants). What you could do is do a request for each points you think is relevant in the navigation path then consolidate the necessary data from the response. You can see the Place Details docs for more details.
I think it'll be easier if you just choose the center of the navigation path, then provide the radius that will cover it all, but I guess you still prefer the way I mentioned above. Anyways, all formulas and calculations will be up to you. Hope this helps. Good luck.
I would like to display metro lines in an Android application. In fact I need to place markers on several stations, and others on coordinates (LatLng). So, I would like to have google maps of Paris (Paris only for now), and stations over it.
I've already tried GroundOverlay, but it works with small images only I think, I get a NullPointerException when using full size map. (1000 x 1000 px). The image I use is this one http://commons.wikimedia.org/wiki/File:Paris_Metro_map_complete.svg converted in .bmp.
Maybe another way could be to draw with lines & circle each stations, but it's a lot of work !
So my questions are :
1) I there a way to display metro & tram on android maps v2 api, just like the old maps.google.com (website, not the android maps v1 api)?
2) Is there a way to use an image like that as an overlay for maps ?
3) If not, have you another idea ? Add circles & lines is a good idea you think ?
Hope I'm clear...
Thanks a lot !
Audric
I would suggest using a TileOverlay.
You may use SVG file directly with svg-android library, drawing parts of it into Bitmap and then convert into byte[] of PNG file for use in TileProvider.
I also don't see why would you get NullPointerException on a 1000x1000 px image. That is only 4MB in memory. Try converting it into PNG instead of BMP.
I want to build an app that uses GPS data and a building map I provide to show the user where in the building on the map they are. This will be done in a specific building that i already know gets GPS and cell service.
At first I thought the easiest way to do this was to see if I could use Google maps to plot the users location and then just "overlay" my custom building map on top of the Google map so that I wouldnt have to deal with any of the gps information or the complexities of the mapping I would just have to scale my "overlay" to fit properly on top of the Google map so that the user was shown in the correct room in a building. I'm wondering if anyone can provide me any information on how to do this or if there is an easier way to accomplish my map. Any information at all is helpful!
You want...
Google Map View
...and more specifically you will probably want to read the subsection appropriately titled: "Part 2: Adding Overlay Items"
EDIT: Whoops! Nevermind! I misread your question... that is only if you want to overlay an item on the map. Sorry...
There is no possibility to use closer zoom level than that you can see on standard GMap i.e. in browser. Other problem is that google uses GeoPoint class based on cardinal microdegrees to draw overlays, and it's accuracy is to low.
You can look on jGarminImg - it's java library - unfortunately written for using with swing, but it should be relatively easy to make it work with android. On the other hand - you have to make your own map.
You can use standard overlays, or you can make your map in kml format and use this example to display it.
You may be able to achieve this with a custom view that displays your building plan and knows the precise co-ordinates of each corner of the building.
When you receive your location updates you can add a marker to your custom view by translating the real world position into a position in the image using something along the lines of:
pseudocode:
markerX = realWorldX - mapStartX;
markerY = realWorldY - mapStartY;
if( isOnMap( markerX, markerY ) )
{
drawMarker( markerX, markerY );
}
Yes you can overlay bitmap images on top of the Google MapView.
All you have to do is subclass the Overlay class, override the draw method, and draw on the canvas. You have to provide a rectangle of GeoPoints (probably the top left and the bottom right corners) to anchor the building bitmap on top of the MapView. You use mapView.getProjection() to translate the latitude and longitude into xy coordinates on the canvas.
I assume drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint) will be useful here. Bear in mind that src and paint can be null. If the GeoPoints you used are accurate, the bitmap will adjust automatically to pans and zooms, although it might get pixelated if the user zooms in too much.
edit: I am not so confident that Google Maps will have your building stays at the exact same GeoPoints in different zoom levels, so you might have to adjust those values for different zoom levels
If you need only the map of the building, it should not be too difficult to plot the location on an image without using Google Maps, provided that you can determine your location as coordinates inside the building.
You need to know two coordinates: north-west and south-east corners of the building map you are using. When you get GPS location updates, the correct location on the map image can be easily calculated based on these corner coordinates.
I would do it like this,
Place a marker on the google map to indicate the position of the building
Drilling down on the building would load your building map as a custom view. Plot the user location on the custom view
I think trying to overlay your building map on a google map while possible will be more complex to code than doing it via a custom view.
Also overlaying the lowest zoom level with your building map is not going to give you enough resolution unless you have a thumping big building. Whole blocks are pretty small
One issue you have probably already considered is the device will revert to cell tower and wifi for it's location when inside the building giving you a less accurate location fix.
I need to create some map tiles for open street map.
I want them based on OS maps but I want to edit a particular section of the map in photoshop.
I have looked at mobile atlas creator (MOBAC) and can generate tile from the OS maps, but what I want to do is update the main map image first, then generate the tiles with my updates.
I don't think it's possible to do this with MOBAC so can anyone point me in the right direction of what I need to do?
Thanks Bex
I have not heard about MOBAC, but there is a company called CloudMade.
They provide different services around OpenStreetMap data. One of their service is Style Editor:
http://developers.cloudmade.com/projects/show/style-editor
You can create your own style of tiles, i.e. show/hide POIs, change colors for different types of roads, rivers and so on.
Is it what you need?
Finally found a way, use oziexplore to calibrate an image (or a map) and then load the .map file into Mapc2Mapc then generate the tiles in adnav format. Unfortunately then I need to rename all my tiles so they end in .tile rather than .adnav for the default version of OSMDroid.
To explain my problem, I am going to start from a case study that is not what I have to do but which will give you a good idea of what I am talking about.
Imagine the map of the US in which you have the states / provinces. Each of these provinces has got a shape that is random (by random I mean it is not a rectangle, a triangle or a circle). I need to build these shapes independantly, size them correctly and put them at the correct place on the screen to represent the country. Finally, each of these province should be clickable.
To achieve that :
1) I don't want to use google map
2) I guess that I'll have to construct each provine using android path and android region ... can you confirm?
3) Is there a graphical tool for building these paths (photoshop import ?)
4) Assuming that I succeed to build the path, how can I put them at the correct place on the screen ?
5) How can I make these path clickable ?
Basically, I want to build an interactive map with clickable items that doesn't use Google map because it won't necessarly be a real map.
Thanks for your help,
R.
There are lot of variables in the problem you describe:
If you don't want to use google-maps, you'll need to use another engine. There are a few open-source ones available.
If you feel you don't need a map engine, you'll need to provide you're own image of the US to draw on an pin the image to the View
How do you plan to draw the boundaries? Do you have coordinate data for the boundaries or do you plan to draw them manually.
I would suggest first looking at openstreetmap: http://www.openstreetmap.org/ The have a lot of information and tools on creating Maps. From there you can attack adding to the phone. Or you can use their web api and build a web view for doing what you suggest.