I was wondering if its possible to add a tile overlay tot the native
google maps. I have a xyz layer .
What do i have to change in the googlemaps cn1lib code
the code for the layer could be, where GoogleMap = mapInstance. Do i
need a sperate container on top ? So where do i start?
Import com.google.android.gms.maps.model.TileProvider;
Import com.google.android.gms.maps.model. UrlTileProvider;
import com.google.android.gms.maps.model.TileOverlay;
import com.google.android.gms.maps.model.TileOverlayOptions;
Public void setoverlay {
TileProvider tileProvider = new UrlTileProvider(256, 256) {
@Override
public URL getTileUrl(int x, int y, int zoom) {
/* Define the URL pattern for the tile images */
String s = String.format("
http://tiles.openseamap.org/seamark/%d/%d/%d.png",
zoom, x, y);
if (!checkTileExists(x, y, zoom)) {
return null;
}
try {
return new URL(s);
} catch (MalformedURLException e) {
throw new AssertionError(e);
}
}
/*
* Check that the tile server supports the requested x, y and zoom.
* Complete this stub according to the tile range you support.
* If you support a limited range of tiles at different zoom levels, then
you
* need to define the supported x, y range at each zoom level.
*/
private boolean checkTileExists(int x, int y, int zoom) {
int minZoom = 12;
int maxZoom = 20;
if ((zoom < minZoom || zoom > maxZoom)) {
return false;
}
return true;
}
};
TileOverlay tileOverlay =
MapInstance.addTileOverlay(new TileOverlayOptions()
.tileProvider(tileProvider)
.transparency(0.5f));
); }
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/f28f13ea-d1b8-4d1a-ab17-b01dbeb347d2%40googlegroups.com.