Keep custom Google Map overlay tiles visible after zoom - android

I'm using Tile Overlay feature of Google Map for Android to display custom map tiles, provided by third party service.
My problem is that, when user zooms the map, and it switches to next zoom level, already visible tiles are disappearing, and then getTile() method of my TileProvider implemetation is triggered. This causes unpleasant blinking of my map view, and moments when user can see only default map.
Standard Google Map behavior scales and "overzooms" currently visible tiles, until new ones are loaded. Is there any way I can create the same effect with Tile Overlay? I am aware that "overzoomed" tiles can be blurry, but that is ok in my case.

Remove custom tiles when zoom level changed is default Android GoogleMap behavior. To "suppress" it (showing previous map when tiles for zoom±1 level still downloading ) you can:
1) create GroundOverlay with screenshot of current map view. Screenshot of google map you can do like in answers for this question of DiscDev and remove it when tiles downloaded;
2) create custom view which extends MapView class like in this answer and show in overridden dispatchDraw() method whatever you want;
3) you can set ImageView over your MapView and show it with screenshot on it while zoom changed and new tiles loaded. And if necessary you can translate tap events from ImageView to MapView and so on.
I prefer p.2 - create MapView-based custom view, override dispatchDraw() and show temporary map within it while new map loading.

Related

Android google maps tile overlay update on zoom

I have a tile overlay in Android Google Map. Everything works fine. But when I zoom in, all tiles disappear then new tiles are downloaded and only after 1-2 secs(when new tiles are downloaded) the map shows them. Therefore, the map doesn't show tiles for some time. Is there a way to update tiles only when new tiles are downloaded?
I use a basic UrlTileProvider and Aeris Overlay maps.
Anyway, you can download each tile as image to local internal or external storage with, for example, Picasso library (or separate Thread or AsyncTask) and determine "all new tiles are downloaded" event "manually" (e.g. increment downloaded tiles counter on every public void onSuccess() for Picasso or protected void onPostExecute() for AsyncTask or on end of public void run() for Thread and wait that equals all tiles quantity) then use TileProvider for downloaded tiles local storage like in this answer of Alex Vasilkov.
Update
For showing previous map when tiles for zoom+1 level still downloading it's possible to create GroundOverlay with screenshot of current map view. Screenshot of google map you can do like in answers for this question of DiscDev
Update #2
There are several ways to solve you problem: 1) you can create custom view which extends MapView class like in this answer and show in overridendispatchDraw() method whatever you want or 2) you can set ImageView over your MapView and show it with screenshot on it while zoom changed and new tiles loaded. And if necessary you can translate tap events from ImageView to MapView and so on.
I prefer p.1 - create MapView-based custom view, override dispatchDraw() and show temporary map within it while new map loading.

Android Is it possible to change the appearance of the map in the google maps API

I have been searching in the documentation and throughout google. I would like to know if it is possible to place an image over the map the api comes from to use something else as a visual but with the maps gps functionality. Does anyone know if this is possible?
You can use two types of Overlays:
TileOverlays (reference)
A TileOverlay defines a set of images that are added on top of the base map tiles. You can also use tile overlays to add extra features to the map by providing transparent tile images. You need to provide the tiles for each zoom level that you want to support. If you have enough tiles at multiple zoom levels, you can supplement Google's map data for the entire map.
GroundOverlay (reference)
A ground overlay is an image that is fixed to a map. Unlike markers, ground overlays are oriented against the Earth's surface rather than the screen, so rotating, tilting or zooming the map will change the orientation of the image. Ground overlays are useful when you wish to fix a single image at one area on the map. If you want to add extensive imagery that covers a large portion of the map, you should consider a Tile overlay.

Hide everything except Custom Overlay in Android Google Maps Activity

I currently have an overlay set up in my app for google maps on a google maps activity.
The image lines up perfectly, but when you leave the area of the overlay you see the normal google maps view.
I want to hide everything except Custom Overlay, how can I go about doing that?
In order to prevent a user from zooming out from where I have the camera zoomed in and losing the custom overlay, can I lock the user to only be within certain gps coordinates? (The area covered by the custom overlay)
It looks like the answer is creating another overlay like I did, and like cYrixmorten said making it a huge size when putting it in. I used 10,000:
GroundOverlayOptions audubonTrailMap = new GroundOverlayOptions()
.image(BitmapDescriptorFactory.fromResource(R.drawable.trailmapimage))
.position(schlitzAudubon, 10000f, 10000f);
mMap.addGroundOverlay(audubonTrailMap);

How to add a GLSurfaceView to an Android maps v2 marker InfoWindow

Are there any restrictions as to what types of custom Views can be used in an Android maps v2 marker InfoWindow? While I have been able to add many types of views, I have not been able to add a GLSurfaceView.
Android maps v2 allows for custom views in a marker's InfoWindow. I understand that the GLSurfaceView will not be interactive in any way, as the Android dev site states:
The info window that is drawn is not a live view. The view is rendered
as an image (using View.draw(Canvas)) at the time it is returned
but I thought that it would at least capture the GLSurfaceView as an image as it exists right when InfoWindow.getInfoContents() is called, but the InfoWindow is only black where the GLSurfaceView would be.
Any ideas?

Google Map API, with my own created Map figure

In android, is it possible that I would create my own Map figure, and then use this Map with the gps location from Google Map API
Example, I draw a map for my own house, then apply Google Map API to be able to make the location of each point in the map
Yes, I believe you can. A couple of options are as follows:
Draw your 'map figure' in an overlay - if the background is translucent, then you'll be able to see the Google map underneath.
Alternatively, use a dummy Google maps API key - in this case the MapView layer is rendered as a grey background but all the API calls appear to work. Again render your 'map figure' in the Overlay draw method.
In both cases, you'll have to ensure the map projection (scale, position, etc) match up with the coordinates of your 'map figure', especially if you scroll or zoom the map view.
It might be best going with the first option, initially, then you'll have a visual confirmation if you're code is correct.

Categories

Resources