Strange behaviour with Osmdroid overlay at high zoom levels <p>I'm using the osmdroid 3.0.5 jar in my app to display a map view. I'm superimposing an overlay, consisting of horizontal and vertical lines. I've noticed that in certain locations only, at high zoom levels some of the lines disappear, then reappear as the map is dragged.</p> <p>I've produced a minimal sample app which demonstrates the problem which exhibits itself both on a real device and an emulator (Gingerbread 2.3.3).</p> <p>The complete code is shown below - (the 'transform' methods are necessary in the real app although they don't appear to be in this minimal sample) :</p> <pre><code>public class DemoMap extends Activity implements MapViewConstants { private MapView mapView; private MapController mapController; private MapOverlay mmapOverlay = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.copymain); mapView = (MapView) findViewById(R.id.mapview); mapView.setTileSource(TileSourceFactory.MAPNIK); mapView.setBuiltInZoomControls(true); mapView.setMultiTouchControls(true); mapController = mapView.getController(); mapController.setZoom(17); // Only shows the bug at ceratin lat/lon positions, this is one GeoPoint point2 = new GeoPoint(39191699, -120102561); mapController.setCenter(point2); mmapOverlay = new MapOverlay(this); List&lt;Overlay&gt; listOfOverlays = mapView.getOverlays(); listOfOverlays.add(mmapOverlay); mapView.invalidate(); } public class MapOverlay extends org.osmdroid.views.overlay.Overlay { public MapOverlay(Context ctx) {super(ctx); } private int mVpl;// viewport left, top, right, bottom private int mVpt; private int mVpr; private int mVpb; private MapView mMv = null; // Two routines to transform and scale between viewport and mapview private float transformX(float in, MapView mv) { float out; out = ((mVpr - mVpl) * in) / (mv.getRight() - mv.getLeft()) + mVpl; return out; } private float transformY(float in, MapView mv) { float out; out = ((mVpb - mVpt) * in) / (mv.getBottom() - mv.getTop()) + mVpt; return out; } @Override protected void draw(Canvas pC, MapView mapV, boolean shadow) { if (shadow) return; Paint paint; paint = new Paint(); paint.setColor(Color.RED); paint.setAntiAlias(true); paint.setStyle(Style.STROKE); paint.setStrokeWidth(1); paint.setTextAlign(Paint.Align.LEFT); paint.setTextSize(12); final Rect viewportRect = new Rect(); final Projection projection = mapV.getProjection(); viewportRect.set(projection.getScreenRect()); mVpl = viewportRect.left; mVpt = viewportRect.top; mVpr = viewportRect.right; mVpb = viewportRect.bottom; // draw two lines to split screen into 2x2 quarters // drag the map left and right and the vertical line disappears, // then reappears! It's OK at one less zoom level pC.drawLine(transformX(mapV.getWidth()/2, mapV), transformY(0, mapV), transformX(mapV.getWidth()/2, mapV), transformY(mapV.getHeight(), mapV), paint); pC.drawLine(transformX(0, mapV), transformY(mapV.getHeight()/2, mapV), transformX(mapV.getWidth(), mapV), transformY(mapV.getHeight()/2, mapV), paint); } } } </code></pre> <p>Interestingly if, in my real app, if I do the drawing to an offscreen bitmap, then draw it all in one go at the end of the Overlay's draw, it's OK the lines don't disappear.</p> <p>Any help will be much appreciated.</p>