Closed GoogleCodeExporter closed 8 years ago
The tile source you are using doesn't support zoom levels higher than 18. The
default tile source is "mapnik" which only supports up to zoom level 18.
Original comment by kurtzm...@gmail.com
on 26 Apr 2013 at 1:52
Hi Marc
Thank you for your invaluable feedback. So what tile source do I need to use to
go beyond zoom level 18 and how?
Once again, thank you for your input.
Cheers
Siva
Original comment by siva.chi...@gmail.com
on 26 Apr 2013 at 3:30
You should either create a new tile source that correctly reflects your true
maximum zoom level, or you can use setMaxZoomLevel to override the tile
source's maximum zoom level.
Original comment by kurtzm...@gmail.com
on 26 Apr 2013 at 4:48
Thank you for your quick response. Greatly appreciate it.
setMaxZoomLevel is not a method within MapView in osmdroid-android-3.0.9.
However, the source codes do have this method but when compile it and
referenced it to my application, the map did not show up.
I tried to create a new tile source but did not work. I am new to this
framework and so I am unsure how to do it. Here is the code:
final MapTileProviderBasic tileProvider = new
MapTileProviderBasic(getApplicationContext());
final ITileSource tileSource = new XYTileSource("maps", null, 11, 21, 256, ".png");
tileProvider.setTileSource(tileSource);
final TilesOverlay tilesOverlay = new TilesOverlay(tileProvider, this.getBaseContext());
tilesOverlay.setLoadingBackgroundColor(Color.TRANSPARENT);
mapView.getOverlays().add(tilesOverlay);
Original comment by siva.chi...@gmail.com
on 26 Apr 2013 at 8:02
You need to have a tile source that actually contains data beyond 18. So you
can create a tile source based on the Mapnik tile source and that will allow
you to zoom beyond 18, but you won't get any tiles (in most areas?). If you
still want to do this:
new XYTileSource("Mapnik", ResourceProxy.string.mapnik, 11, 21, 256, ".png",
"http://tile.openstreetmap.org/")
Take a look at TileSourceFactory to see the pre-loaded available tile sources.
Original comment by kurtzm...@gmail.com
on 29 Apr 2013 at 1:56
Thank you for your helpful hint, Marc
When I added your code snippet to our application(see below), I get the
openstreet map tiles in the background. I also get our own custom satellite
imagery tiles on top of it. But the zoom level still doesn’t go beyond 18.
What I want is only our custom map displayed and we do not need openstreet map.
We also want to be able to zoom beyond 18. Though our custom tiles has zoom
levels from 11 to 21, why can’t we zoom beyond 18. What is wrong with our
codes?
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapView mapView = new MapView(this, 256); //constructor
// Add tiles layer with custom tile source
final MapTileProviderBasic tileProvider = new MapTileProviderBasic(getApplicationContext());
final ITileSource tileSource = new XYTileSource("Mapnik", ResourceProxy.string.mapnik, 11, 21, 256, ".png","http://tile.openstreetmap.org/");
tileProvider.setTileSource(tileSource);
final TilesOverlay tilesOverlay = new TilesOverlay(tileProvider, this.getBaseContext());
tilesOverlay.setLoadingBackgroundColor(Color.TRANSPARENT);
mapView.getOverlays().add(tilesOverlay);
mapView.setBuiltInZoomControls(true);
mapView.setMultiTouchControls(true);
setContentView(mapView);
mapView.getController().setZoom(20);
mapView.getController().setCenter(new GeoPoint(41.403918,-95.003335));
mapView.setUseDataConnection(false); //keeps the mapView from loading online tiles using network connection.
}
Original comment by siva.chi...@gmail.com
on 29 Apr 2013 at 5:27
[deleted comment]
You don't want to add a new TilesOverlay. You want to set the tile source for
the existing tile provider.
mapView.setTileSource(tileSource);
Original comment by kurtzm...@gmail.com
on 2 May 2013 at 12:51
Original comment by kurtzm...@gmail.com
on 2 May 2013 at 12:51
Original issue reported on code.google.com by
siva.chi...@gmail.com
on 25 Apr 2013 at 9:18