AGSPoint spatial reference

2157
1
05-13-2011 11:03 AM
KalaiRamea
New Contributor
Hi All,

I am having trouble in projecting the AGSPoint marker location to the right place.

I have this spatial reference for the map:

AGSSpatialReference *sr = [AGSSpatialReference spatialReferenceWithWKID:4326];
AGSEnvelope *env = [AGSEnvelope envelopeWithXmin:-125.33203125 ymin:-1.58203125 xmax:-69.08203125 ymax:79.27734375 spatialReference:sr];

It takes in the latitude longitude values well and draws the US map. But, when I give the AGSPoint location with latitude longitude, it locates it somewhere near Africa:

AGSPoint *myMarkerPoint =
[AGSPoint pointWithX:-121.78555
                                     y:38.549122 spatialReference:sr];

It is able to locate the right location if I give this code below:


   AGSPoint *myMarkerPoint =
[AGSPoint pointWithX:-13626513.829723023
                       y:4549088.827634182 spatialReference:sr];

I'm not sure what these numbers refer to (or how to convert lat, long to this). I am confused as to why AGSPoint is not identifying the lat, long location but with the same spatial reference, AGSEnvelope is drawing correctly.

Please help!

Thanks,
Kalai
0 Kudos
1 Reply
NimeshJarecha
Esri Regular Contributor
Seems that your base map or map's spatial reference is "web mercator" or may be something else (not wgs 1984). Please provide more information about all layers in the map and their spatial reference. You can use the AGSGeometryEgnine's project method to project the input (wgs 1984) point to map's spatial reference (self.mapView.spatialReference) and then it'll locate you correctly.

Hope this helps!

Regards,
Nimesh
0 Kudos