How to add custom layer to Google Maps - android

I am developing an android app in which I am capturing location using Google Maps API v2. I have a large satellite image ( greater than 500 mb ), this image is geo-coded. We need to display this as one of the layers in the Google Maps like Google map has a choice for satellite imagery. How can it be done. As for using tile overlay we need tiles but I have a single image and that to it is very big in size so I cannot use ground overlay also. I am kind of stuck right now.

Try this instead of custom layer overlay we add
https://developers.google.com/maps/documentation/android-api/tileoverlay

This is doable but you're going to have to do more. You will use Tile Overlays method, but since your file is too big, you'll be needing to cut it in equal dimensions, 256dp for example.
To cut your big map file in tiles you'll be using MapTiler. The software will do the cutting for you and will generate the map files. Kudos for this thread for the additional info.

Related

Graphic below specific area in some Android Map API

I'm looking form maps API that would allow me to put pattern in some form (maybe graphic) below forest area, to have something like this (image below) and not only plain colour. Later on I would need to put such images on different areas and roads, also ability to put some 3D building on map would be great.
I found only ways of adding 3D objects and chagning area colours. Maybe I'm using bad words but only results on stackverflow and google were for custom background in markes.
Can you recommend some map API? (If you have some open-source project where I can see how its done it would be awesome. Thank you for your help.
After a lot o research I found the solution. It is to use mapbox with it's vector tiles.
proiblem - area overlay:
Using mapbox styles you can use background-pattern,
fill-pattern, line-pattern, fill-extrusion-pattern, or icon-image properties to overlay specific area type, so you can have even SSJ Blue Songo face covering whole forests :D. Vector tiles same as google API can be also colored as you like.
problem - 3D objects
3D objects like buildings can be placed in desired position, I even found some screanshots with mapbox and car placed on map.
Additionally it seams that when using Vector tiles you can use isometric view. Not yest tested, but form this tutorial it looks like it is possible. For all that hate paying for map services I found that you can host your own tile server and it will works as long as you provide tiles that are compatible with their tile specification.
Alternative solution I decided to use is to render vector tiles on your own. There are two good services to obtain tiles:
Mapbox tiles in MVT format - any zoom, to get tile just use link https://api.mapbox.com/v4/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v7/{z}/{x}/{y}.mvt?access_token={access_token}
MapTiler Tilehosting tiles in PBF format - zoom max 14, PBF format is basically same as Mapbox MVT (same parsers might be used), to get tile just use link https://free.tilehosting.com/data/v3/{z}/{x}/{y}.pbf?key={access_token}
When decoding thies some Polygons might not parse properly, here is answer for that question:
Mapbox vector tile MVT is missing data
Rendered tiles can be used with google API by TileOverlay, this gives all Google API features and it is easy to use (mMap.setMapType(GoogleMap.MAP_TYPE_NONE); to disable all google map labels). Downside is of course tile rendering that needs to be done on your won, but for me this is positive, because I have full control on what is displayed (I use OpenGL ES, I recommend EGL14, off-screen rendering here).

Overlay image google maps

In my app I added the map of Google Maps and you can navigate within a given area (which can not be done through maps as it is not drawn). Now I would like to customize the map and add image overlays to the buildings so as to better target people. Let me explain with an example:
In the picture is the image of the building that I customized.
Now I want place the image over the google map. I saw that there GroundOverlay but I can not place it properly.
Does anyone have any tips?
I would recommend using Polygon Shapes instead of Images. Working with Images like you intend to do, would probably be very hard later on.
You might want to look at:
https://developers.google.com/maps/documentation/android-api/shapes

Make android google maps polyline appear above street names?

How to add a polyline to google map in android above street/area name?
I think this is not possible in an easy way due to how google maps API handles the "background".
If you set the background to normal or hybrid, the map is drawn as a background either in road view like your screenshot or in satellite view if hybrid is selected.
Then all the users features are drawn (and eventually overlays, lines, poligons, then points and lastly, street names. You can't really change this, but you could do a trick:
- Use just the satellite view (so no roads will be added).
- Remove the google background and add an alternative one (there are different services like Open Street Map, Mapnik ecc that allows it).
Following the second choice could also allow to add googlemaps background from web api, but I really don't advice to do it, since you are downloading tiles in a non standard way for google.

Creating custom maps over Google Maps is possible nowadays?

A few years ago we wanted to add a custom map over Google Maps (like the World looks like Midearth), but back then it was not possible. Now, I can see multiple apps that have their own overlay over Google Maps.
I tried creating my own map via Google Maps using their suggestions, but this was only for pins and routes.
What I need is to have the real cities on the map (like Rome, London, Paris), but with my own custom graphics for everything (map tiles, pins, etc.).
What document shall I read for this? I am sure I missed something on Google Maps.
Yes! It is possible with Google Map V2. You should consider using TileOverlay.
Essentially, every time GoogleMap wants to draw tile for specific coordinate - it asks you to provide this tile. You can use either static tile (see TileProvider) or you can provide URL, so GoogleMap goes to your web server and downloads this tile automatically (see UrlTileProvider)
I think what you want is GroundOverlay which can be any bitmap image that will be displayed on top of the basemap. You can even control the translucency of your map.
You most likely want to have your map image oriented north up and be scaled according to Mercator projection if the scale of your map is large enough to include Rome, London, and Paris. But if your map covers a smaller area, you don't need to worry about Mercator projection.

How to draw custom map tiles without OSMDroid apis in Android?

I went through lots of searching the web which shows how to draw custom tiles on top of Google Maps using OSMDroid apis. I have my custom tiles png files ready to use.
But I am looking for a way which will help me to draw custom tiles on top of default google map tiles. I also found this link which says to use overlays for the same.
Now I am confused between the overlays and custom tiles; please correct me if I am wrong, as I think overlays are the one we use as markers on top of a map.
How can I draw custom tiles without using OSMDroid in Android?
An overlay is just a layer, it can contain pins or tiles.
You need an overlay to display your tiles.
OSMDroid is the only current way I know for displaying tiles over Google Maps.
You can see how to use it there:
https://groups.google.com/group/osmdroid/browse_thread/thread/1e2219b8e2d28edb/6c1ed8e13520fce1

Categories

Resources