Why is projection not working using my MapView's spatial reference? (ArcGIS SDK for Android) -
i have mapview
called mmapview
. want add point graphic map. here did:
point p1 = new point(66.9969, 6.65428); //i took coordinate gps device demonstration point p2 = (point) geometryengine.project( p1, spatialreference.create(4326), mmapview.getspatialreference()); graphic graphic = new graphic( p2, new simplemarkersymbol(color.red, 10, simplemarkersymbol.style.diamond)); mgraphicslayer.addgraphic(graphic);//mgraphicslayer graphicslayer on mapview
when ran program marker not there on mapview
. when replaced mmapview.getspatialreference()
spatialreference.create(32637)
graphic appeared in right position wanted. why happening? checked mapview
spatial reference id
, latestid
, and 102100 , 3857 respectively.
my guess map doesn't yet have spatial reference when call project
. it's hard because didn't in app code snippet is. if put in activity
's oncreate
method, map's spatial reference null
still. try onstatuschangedlistener
, this:
mmapview.setonstatuschangedlistener(new onstatuschangedlistener() { public void onstatuschanged(object source, status status) { if (status.initialized.equals(status)) { mgraphicslayer = new graphicslayer(); mmapview.addlayer(mgraphicslayer); point p1 = new point(66.9969, 6.65428); point p2 = (point) geometryengine.project( p1, spatialreference.create(4326), mmapview.getspatialreference()); graphic graphic = new graphic( p2, new simplemarkersymbol(color.red, 10, simplemarkersymbol.style.diamond)); mgraphicslayer.addgraphic(graphic); } } });
another possibility coordinates not in latitude , longitude. written, lon = 66.9969 , lat = 6.65428, should in ocean near india. if meant lon = 6.65428 , lat = 66.9969, in ocean near norway. if didn't mean either of locations, coordinates either incorrect or not in latitude , longitude.
Comments
Post a Comment