How to zoom into a city using JMapViewer without multiple calls to `setZoom()`

282 views Asked by At

I'm using OpenStreetMap with JMapViewer and trying to zoom my map onto a street level view of central London, but I can't zoom in my map.

I have tried using code like this:

map().setCenter(new Point(900, 600))
map().setZoom(50);
map().setDisplayPosition(200,200, 4)

However, I can only zoom onto central London successfully with code like this:

map().setZoom(10);
map().setCenter(new Point(131000, 87150));
map().setZoom(12);

Why did I need to set the zoom multiple times to get the zooming to work?

Is it possible to limit the number of zoom levels? I've found this non-Java specific method of doing so, but not a Java specific implementation of limiting zoom levels.

0

There are 0 answers