Hi:Will there be a WebMercatorUtil class available in the iPhone API, similar to the Flex API? This is a popular and convenient class in the Flex API for taking lat/lon geocoding results and projecting them to Web Mercator for display on modern basemaps. Or do we need to use the AGSGeometryService task?Trying to keep the lines of code to a minimum,Matt English
function ll2meters(lat,lon) { // Converts given lat/lon in WGS84 Datum to XY in Spherical Mercator EPSG:900913 var originShift = 2 * Pi() * 6378137 / 2.0; var ret = StructNew(); mx=0; my=0; mx = lon * originShift / 180.0; my = Log(Tan((90 + lat) * Pi() / 360.0 )) / (Pi() / 180.0); my = my * originShift / 180.0; ret.x = mx; ret.y = my; return ret; } function meters2ll(mx,my) { // Converts XY point from Spherical Mercator EPSG:900913 to lat/lon in WGS84 Datum" var originShift = 2 * Pi() * 6378137 / 2.0; var ret=StructNew(); lon=0; lat=0; lon = (mx / originShift) * 180.0; lat = (my / originShift) * 180.0; lat = 180 / Pi() * (2 * Atan( Exp( lat * Pi() / 180.0)) - Pi() / 2.0); ret.lat = lat; ret.lon = lon; return ret; }
AGSGeometryGeographicToWebMercator AGSGeometryWebMercatorToGeographic
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.