user29491153
user29491153

Reputation: 1

osmdroid large polygon created on wrong places

I'm trying to create a large Polygon that cover the entire map. But after a value the polygon will be drawn from the other side of the map(?).

width is between -90 and +90°

width is 90.5°

it should still work because the minimum and maximum should be -180 and 180.

 mapView =  findViewById(R.id.map);
        mapView.setTileSource(TileSourceFactory.MAPNIK);
        mapView.setVerticalMapRepetitionEnabled(false);
        mapView.setHorizontalMapRepetitionEnabled(false);

        mapController = (MapController) mapView.getController();
        mapController.setZoom(5);
        mapController.setCenter(new GeoPoint(47.0,19));
        mapView.setMultiTouchControls(true);

        Polygon hidePolygon = new Polygon();
   
        double centerLat = 0.0;
        double centerLon = 0.0;
        double height = 50;
        double width = 181;

        List<GeoPoint> rectanglePoints = Arrays.asList(
                new GeoPoint(centerLat + height / 2, centerLon - width / 2), 
                new GeoPoint(centerLat + height / 2, centerLon + width / 2), 
                new GeoPoint(centerLat - height / 2, centerLon + width / 2), 
                new GeoPoint(centerLat - height / 2, centerLon - width / 2),
                new GeoPoint(centerLat + height / 2, centerLon - width / 2)  
        );
        hidePolygon.setPoints(rectanglePoints);
        hidePolygon.getFillPaint().setARGB(255,0,0,0);
        mapView.getOverlayManager().add(hidePolygon);

I haven't found any topic related to this problem on github or here

Upvotes: 0

Views: 16

Answers (0)

Related Questions