bronder@kth.se

GeometryEngine.project - YUNOwork? ^^

Discussion created by bronder@kth.se on Mar 4, 2013
Latest reply on Mar 5, 2013 by bronder@kth.se
Hey guys,

can´t seem to be able to project my GPS coordinated from Google maps to map coordinates. What am I doing wrong?

here le code:

Point wgspnt = new Point();
wgspnt.setXY(-29.34016, 27.466609);
//Google maps: We use EPSG:4326 (WGS 84) for coordinates (Lat/Long). The projection we use is Mercator (EPSG:3857)
  
Log.i(TAG, "wgsLatBEFORE=" + wgspnt.getX()); //wgsLatBEFORE=-29.34016
  
Point mapPoint = (Point) GeometryEngine.project(wgspnt, SpatialReference.create(4326), mMapView.getSpatialReference()); 
//have also tried from 3857, with the same result
  
Log.i(TAG, "wgsLatAFTER=" + mapPoint.getX()); //wgsLatBEFORE=-29.34016 (STILL!)
  
Graphic poi1 = new Graphic(mapPoint, marker);
gLayer.addGraphic(poi1);
mMapView.addLayer(gLayer);


To me, GeometryEngine.project seem to do nothing here and the point ends up close to 0.0 instead of in Lesotho.
I am also displaying a point in Switzerland that ends up in the right place: Point chPoint = new Point (947296, 6008979); so thats the type of coordinates I want to project into.

Outcomes