Get GPS Coordinates on mouse tap/click on ArcGIS Esri Map in Windows Runtime Apps (Windows 8.1) -
how gps coordinates (longitude, latitude) of clicked/tapped point in arcgis esri map?
i tried mapviewtapped
event like:
private void mymapview_mapviewtapped(object sender, mapviewinputeventatgs e) { var x = e.position.x; //e.location.x; var y = e.position.y; //e.location.y; }
both gives large unexpected values.
you're using mapviewinputeventargs.position property - gives screen coordinates - see sample code show mouse coordinates. use location property map coordinates, shown in sample.
worth noting it's map using web mercator coordinate system - e.g. if have created mapview using default esri basemaps. if so, map coordinates reported in meters, approximately in range -20,000,000 +20,000,000.
the coordinate system wgs84 gives latitude , longitude in degrees, , used gps systems. convert point coordinate system (e.g. spatialreference of mapview, if different that), can 'project' point - use project method on geometryengine class, , pass in mappoint , spatialreference want, e.g.
mappoint projectedpoint = geometryengine.project(e.location, spatialreferences.wgs84);
see project coordinate sample demonstrates that.
Comments
Post a Comment