Skip to content Skip to sidebar Skip to footer

Osmdroid Displays Multiple Maps With Polylines In Android

I see multiple maps with polyline when I start my android application. How can I show only one map? MainActivity: public class MainActivity extends AppCompatActivity { MapVie

Solution 1:

I solved that with this:

MapView map = (MapView) findViewById(R.id.map);
map.setScrollableAreaLimitDouble(new BoundingBox(85, 180, -85, -180));
map.setMaxZoomLevel(20.0);
map.setMinZoomLevel(4.0);
map.setHorizontalMapRepetitionEnabled(false);
map.setVerticalMapRepetitionEnabled(false);
map.setScrollableAreaLimitLatitude(MapView.getTileSystem().getMaxLatitude(), MapView.getTileSystem().getMinLatitude(), 0);

Solution 2:

Your code is correct and you actually see only one map - meaning only on map component. The map is zoomed out too much and is smaller then the view. The osmdroid library solves this problem by repeating the map in the viewport. I don't think there is a way to turn this feature off.

You can solve the problem by setting some reasonable zoom level.

map.setZoomLevel(12)

Solution 3:

MapView map;
map.setHorizontalMapRepetitionEnabled(true);
map.setVerticalMapRepetitionEnabled(false);
map.setScrollableAreaLimitLatitude(MapView.getTileSystem().getMaxLatitude(), MapView.getTileSystem().getMinLatitude(), 0); 

Post a Comment for "Osmdroid Displays Multiple Maps With Polylines In Android"