I would suggest you to look into the GeometryServiceTaskDemo sample app which has a code to buffer the geometries. It will give you an idea to work with geometry service task and similarly you can use projectGeometries:toSpatialReference: method to project the geometry. It get installed with SDK at ~/Library/SDKs/Samples.Please feel free to let me know if you need any further help!Regards,Nimesh
- (NSOperation *) projectGeometries: (NSArray *) geometries toSpatialReference: (AGSSpatialReference *) spatialReference
AGSSpatialReference *osr; osr = [[AGSSpatialReference alloc] initWithWKID:3414 WKT:@SVY21];
double lat = location.coordinate.latitude; double lon = location.coordinate.longitude;
Hi Nimesh,I've looked into GeometryServiceTaskDemo but still do not understand it. I need to mention that this if my first time coding on iPhone so I'm unfamiliar with Objective-C.You mentioned about projectGeometries:toSpatialReference.- (NSOperation *) projectGeometries: (NSArray *) geometries toSpatialReference: (AGSSpatialReference *) spatialReference How should I code the method for my case? I've tried around different code but due to lack of experience with Objective-C I've got no idea how to get it to work.Your help would be greatly appreciated!Regards,Royston
AGSSpatialReference *svy21 = [[AGSSpatialReference alloc] initWithWKID:3414 WKT:@PROJCS[\SVY21 / Singapore TM\",GEOGCS[\"SVY21\",DATUM[\"D_\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",1.366666666666667],PARAMETER[\"central_meridian\",103.8333333333333],PARAMETER[\"scale_factor\",1],PARAMETER[\"false_easting\",28001.642],PARAMETER[\"false_northing\",38744.572],UNIT[\"Meter\",1]]"]; 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]]"];
self.gst = [[[AGSGeometryServiceTask alloc] initWithURL:[NSURL URLWithString:kGeometryProjectService]] autorelease]; AGSSpatialReference *tosr = [[[AGSSpatialReference alloc] initWithWKID:4326 WKT:nil] autorelease]; self.gst.delegate = self; AGSSpatialReference *fromsr = [[[AGSSpatialReference alloc] initWithWKID:3414 WKT:nil] autorelease]; AGSPoint *pp = [[AGSPoint alloc] initWithX:26332.346744 y:37434.157586 spatialReference:fromsr]; [self.gst projectGeometries:[NSArray arrayWithObjects:pp, nil] toSpatialReference:tosr];
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.