Polyline never cross the 180 meridian

837
2
12-08-2017 07:14 AM
PatrickBolduc
New Contributor II

Hi,

When I try to draw a polyline that cross the 180 meridian, the polyline always go across the earth instead of crossing the 180 meridian as I would expect. I am using the 100.1 version of Android ArcGIS runtime.

Here is an example to reproduce the issue and a screenshot

public class PolylineAcross180MeridianActivity extends AppCompatActivity
{
    private MapView mapView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_polyline_across180_meridian);
        mapView = findViewById(R.id.map_view);

        mapView.setMap(new ArcGISMap(Basemap.createImagery()));
        final GraphicsOverlay overlay = new GraphicsOverlay();
        mapView.getGraphicsOverlays().add(overlay);
        final Point p1 = new Point(-170, 0.0, SpatialReferences.getWgs84());
        final Point p2 = new Point(170, 0.0, SpatialReferences.getWgs84());
        final Polyline polyline = new Polyline(new PointCollection(Lists.newArrayList(p1, p2)));
        final SimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, getColor(android.R.color.holo_red_dark), 5f);
        overlay.getGraphics().add(new Graphic(polyline, simpleLineSymbol));
    }
}

Is it a way to have the polyline cross the 180 meridian ?

Regards,

Patrick

0 Kudos
2 Replies
AlexanderNohe1
Occasional Contributor III

Rather than have your second point be at 170, what happens if you set your second point to -190 ?

0 Kudos
JamieHolloway
New Contributor

This is a great question Patrick.  I am a newbie to ArcGIS Pro, the dev APIs, and ESRI in general...but I am unable to project a line that crosses the meridian by either using configuration settings, such as 'enable wrapping around date line,' or by writing code to split the line into a polyline that attempts to create a pivot point over the meridian.  I have this problem with the ArcGIS Pro app, and when using JavaScript APIs.  It does not work for either Mercator or spherical projections.  My kml / Google Earth solution does this by default.  I've studies the esri forums w/o solution...  Its a real show stopper.  I have ESRI-expert colleagues who have not been able to guide me to a solution yet...

0 Kudos