Datenshi Datenshi - 1 year ago 168
Android Question

Arcgis android, not showing the correct coordinates

I am new to arcgis, and I would like to do a simple thing, yet I can't understand why it does not behave as expected. I am trying to add a point on my mapView. It is added, but in the wrong place.

// I have longitude and latitude saved as strings
// x = 53.230
// y = 20.398
Point result = new Point(Float.parseFloat(x),Float.parseFloat(y));

 Point mapPoint = (Point) GeometryEngine.project(Double.parseDouble(x), Double.parseDouble(y), SpatialReference.create(4326));

     Geometry resultLocGeom = mapPoint;
Geometry resultLocGeom = result; // using mapPoint or result, both gets placed in same place.

 SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(
   Color.BLACK, 20, SimpleMarkerSymbol.STYLE.CROSS);

 Graphic resultLocation = new Graphic(resultLocGeom,


 TextSymbol resultAddress = new TextSymbol(12, list2.get(i)[3], Color.BLACK);



 Graphic resultText = new Graphic(resultLocGeom, resultAddress);


I know that latitude and longitude are both correct, but my point gets shown somewhere in the Atlantic for some reason...

Answer Source

I think you're on WGS84 and you need to use Web Mercator.

Here is a similar post online.


$.each( fs.features, function(k, v){
    point=new esri.geometry.Point( v.geometry.x, v.geometry.y, new esri.SpatialReference({ wkid: 4326 }));
    point_merc = esri.geometry.geographicToWebMercator(point);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download