0

How can I always get the current map's south-west MapPos and north-east MapPos when I zoom in/zoom out the map or drag the map? I want to create a dynamic bounding box for Carto Map.

0

You should use mapView.screenToMap method with screen corner locations. Here is Java sample, C# is practically same:

ScreenPos sp1 = new ScreenPos(0, mapView.getHeight() / 2);
ScreenPos sp2 = new ScreenPos(mapView.getWidth(), mapView.getHeight() / 2);
MapPos mp1 = mapView.screenToMap(sp1);
MapPos mp2 = mapView.screenToMap(sp2);
MapPos pos1Wgs = mapView.getOptions().getBaseProjection().toWgs84(mp1);
MapPos pos2Wgs = mapView.getOptions().getBaseProjection().toWgs84(mp2);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.