I'm currently working on a App that uses a custom TileSource to display data on Google Maps. I get those data in form of *.png images, and I'm using the URLTileProvider.
Everything is working well, but I'm now trying to make the TileLayer transparent, or at least, partly. The goal is, that the layer is visible but the underlying Google Maps still shines through. Somehow I'm stuck, as I do not know how to achieve this.
I did not find a way to fully implement a custom TileProvider, it seems one can only extend URLTileProvider
Serverside imagemanipulation is not possible, as the data is given
There are no options to make a TileOverlay transparent? (alpha, opacity, transparency)
I'd be very helpful if someone could hint me in the right direction, or tell me whether the Google Maps API V2 for Android really does not support this feature.
At this moment it is not possible to specify transparency for TileOverlay in android maps sdk v2.
Unfortunately setTransparency(float) method is available for GroundOverlay only.. The only way to do this - is to implement your own TileProvider and change png 'on-the-fly' to change alpha channel.
Can you make the tile images themselves transparent? The URLTileProvider can point to any images so if the image has alpha, it should work.
You can implement a TileProvider directly but you will have to take care of loading your own image data in that case. It seems like that would be more desirable if you want to generate tiles dynamically on the client.
Related
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).
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
So, my question is somewhat of an odd request I think. I was an intermediate java programmer making android apps a couple years ago, but I quit for other things. Now I'm back with a new and (I think) somewhat bold idea and I need help.
I'm wanting to know if it is possible to utilize the google maps api to act as a base for another map that I layer over the top. Think of it as I'm changing the way the map looks and that's about it.
I'm wanting to create a mobile app that has a map with a new/different look than what the base and satellite views have for a set small area of the city. Think of it as something like taking any old image and slapping it over the top of the google map and still being able to navigate with it (obviously if it was a random picture you wouldn't be able to see where it was taking you, but in theory you could essentially create a new map).
Is this possible in both java and obj c?
As far ask I know, you can't add your own tile layer to the Google Maps API for Android. However, you can use osmdroid and add your own tiles. You could also use mapsforge for Android. It comes with it's own tool for creating custom map tiles.
Not really sure how to explain this easily, but here goes. I want to make a highlight overlay on the whole Google Map in Android, except one rectangular are which would stay as default. Basically, the opposite, inverted version of this:
Drawing area at Google Map
Any ideas how to configure this?
Thankyou in advance,
Alex
P.S
Just to keep clear, the example for Javascript is just for picturing purpose, I need this for regular Java :).
Have a look at this Masked Polygon library for Google Maps. https://github.com/vasile/Mask-KML-polygons
Is there any way to implement falling pins/markers animation for google maps in android like that in iPhone ???
Android has overlay markers (see ItemizedOverlay) that make it easy to add images to maps, BUT note that, in my experience at least, animated images do not work when added to overlays.
I found it necessary to add a View on top of the MapView, and add imagery to that, and I've successfully added animated drawable images to the map using that approach. For more details see here:
Can I use AnimationDrawable in an overlay on a MapView?
But to be honest, you should remember that it's Android, and copying every little feature from iOS is unnecessary. Google Maps on Android doesn't use a pin marker, it uses a static blue spot - I'd say it's best to replicate that and remember your users are Android users, not iOS users - they want consistency across Android apps.
You could have a look in this docmentation: https://developers.google.com/maps/documentation/javascript/overlays
Here is an example map.
Just add this in your code:
marker.setAnimation(google.maps.Animation.DROP);