Problems Initializing AGSSpatialReference

2223
2
03-24-2010 10:59 AM
ChanceYohman
New Contributor
//Also tried using epsg:4326 for the WKT cey 03.24.10
 AGSSpatialReference* wgs84 = [AGSSpatialReference spatialReferenceWithWKID:4326 WKT:@"GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]"];
 
 AGSPoint* denali = [AGSPoint pointWithX:69.0659000 y:-151.0074000 spatialReference:wgs84]; 
 
 [locator addressForLocation:denali maxSearchDistance:0];


I tried initializing the spatial reference above with the given code. I used two different WKTs. It and the point appear to be fine. When I pass the point to the addressForLocation call, it executes and I end up in the didFailAddressForLocation function. Can anyone point out what I am doing wrong? The code block above begins on line 68 of AGSAddressCandidateViewController.m .
0 Kudos
2 Replies
NimeshJarecha
Esri Regular Contributor
This is how you can initialize spatial reference and point,

AGSSpatialReference *wgs84 = [[AGSSpatialReference alloc] initWithWKID:4326 WKT:@"GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]"];
AGSPoint *denali = [[AGSPoint alloc] initWithX: -117.194958859564 y:34.0573637535114 spatialReference: wgs84];

You can verify the result from code with following URL,

http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Address_NA/GeocodeServer/reverseGeoco...

Regards,
Nimesh
0 Kudos
ChanceYohman
New Contributor
Thanks Nimesh. By the looks of it, I missed the [AGSPoint alloc]. Actually, no, I switched the lat and longs. Still, I'm thankful for extra eyes. Sorry for the unnecessary post.
0 Kudos