Geometry Type: esriGeometryPoint  Extent:  XMin: YMin: XMax: YMax: Spatial Reference: 102113

3265
2
07-23-2014 03:15 PM
SavioGoncalves
New Contributor

Hi,

 

My question: Do we have to work with ArcGIS Runtime SDK for iOS in order to plot esri points x,y ?

 

I live in Portugal, and the city of Lisbon has many web services we can use, but I found myself in a big issue:

i.e (if I try to use one of the web services api they have at:
http://digc.cm-lisboa.pt/DIGC/...

and if I choose i.e. option /116/1 that stands for "traditional coffee shops" and get the first item
http://digc.cm-lisboa.pt/DIGC/...

Just take a look at the geo coordinates....

What the hell is Point:
X: -1024499,0043
Y: 4678426,5468

if I try to draw it on the map it doesn't correspond to the real Lat Long for that coffee shop.

Take a closer look at this link:
http://digc.cm-lisboa.pt/DIGC/...
Geometry Type: esriGeometryPoint

Extent:
XMin: -1028372.32756313
YMin: 4676782.25640479
XMax: -1011303.94154349
YMax: 4693079.50182223
Spatial Reference: 102113

//My question:
//Do we have to work with ArcGIS Runtime SDK for iOS in order to plot esri points x,y ?

- (void)viewDidLoad {
[super viewDidLoad];

NSURL *mapUrl = [NSURL URLWithString:@"http://services.arcgisonline.c..."];
AGSTiledMapServiceLayer *tiledLyr = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:mapUrl];
[self.mapView addMapLayer:tiledLyr withName:@"Tiled Layer"];

//

AGSSpatialReference *sr = [AGSSpatialReference spatialReferenceWithWKID:102113];
AGSEnvelope *env = [AGSEnvelope envelopeWithXmin:-1028372.32756313 ymin:4676782.25640479 xmax:-1011303.94154349 ymax:4693079.50182223 spatialReference:sr];

[self.mapView zoomToEnvelope:env animated:YES]

}
0 Kudos
2 Replies
ArtemisFili
Esri Contributor

What if you try the method "zoomToGeometry:withPadding:animated" to zoom directly to the point?

10.2.3: AGSMapViewBase Class Reference

0 Kudos
Nicholas-Furness
Esri Regular Contributor

Hi Savio​,

For me, the cafe appears to be in the right place.

2015-03-26_12-39-27.png

So given that, I think your question is about Spatial References.

-1024499.0043,4678426.5468 (x,y in meters) is in Web Mercator Spatial Reference (usually known as WKID 102100 or 3857, but 102113 is an older identifier). This translates to 38.6974539920001,-9.20323083499994 as lat,lon.

You can do one of a few things:

  1. Use the Runtime SDKs (in iOS, an AGSFeatureLayer added to an AGSMapView) to handle them. When you create a layer with the service URL and add it to the map, the Runtime will ensure things are returned from the server appropriately for direct display on the map. This is by far the simplest approach.
  2. If you're querying the REST service directly, Specify the outSR in the service query request: http://digc.cm-lisboa.pt/DIGC/rest/services/OpenDataLX/LxPOI/MapServer/116/query?text=&geometry=&geo...  (see also here for an HTML interface)
  3. Use the runtime GeometryEngine class to project the point from WKID 102113 to WKID 4326.
  4. Do your own maths to translate the Web Mercator (102113) coordinate -1024499.0043,4678426.5468 to the Lat/Lon (4326) coordinate -9.20323083499994,38.6974539920001. There are plenty of algorithms around, but I don't recommend this approach.

So, you don't have to work with the Esri SDKs and APIs to use the data as it comes out of the service, but they can make your life a lot easier if you do.

Does this help?

Nick.​

0 Kudos