Elysium
Elysium

Reputation: 155

Making TileOverlays transparent

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'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.

Upvotes: 8

Views: 2290

Answers (2)

Pavel Dudka
Pavel Dudka

Reputation: 20944

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.

Upvotes: 4

bwacher
bwacher

Reputation: 207

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.

Upvotes: 2

Related Questions