graphicsLayer = [[AGSGraphicsLayer alloc] init]; [mapView insertMapLayer:graphicsLayer withName:@"graphics layer" atIndex:1]; AGSGraphic* g; //Create the AGSSimpleMarker Symbol and set some properties AGSSimpleMarkerSymbol* myMarkerSymbol = [AGSSimpleMarkerSymbol simpleMarkerSymbol]; myMarkerSymbol.color = [UIColor blueColor]; myMarkerSymbol.style = AGSSimpleMarkerSymbolStyleDiamond; myMarkerSymbol.outline.color = [UIColor whiteColor]; myMarkerSymbol.outline.width = 3; //Create an AGSPoint (which inherits from AGSGeometry) that //defines where the Graphic will be drawn double lat = [[record objectForKey:@"lat"] doubleValue]; double lng = [[record objectForKey:@"lng"] doubleValue]; NSLog(@"Point: %f, %f", lat, lng); AGSPoint* myMarkerPoint = [AGSPoint pointWithX:lat y:lng spatialReference:mapView.spatialReference]; //Create the Graphic, using the symbol and //geometry created earlier g = [AGSGraphic graphicWithGeometry:myMarkerPoint symbol:myMarkerSymbol attributes:nil infoTemplateDelegate:nil]; [graphicsLayer addGraphic:g];
Solved! Go to Solution.
NSMutableArray *myMarkerPointArray = [[NSMutableArray alloc] init]; // note that textFileMgmt1.points returns an NSDictionary for ( NSDictionary *item in textFileMgmt1.points ) { AGSPoint *myPoint; myPoint = [AGSPoint pointWithX:[[item valueForKey:@"dict_x_long"] doubleValue] y:[[item valueForKey:@"dict_y_lat"] doubleValue] spatialReference:[AGSSpatialReference wgs84SpatialReference]]; AGSGeometry *myPointReprojected; AGSGeometryEngine *ge = [AGSGeometryEngine defaultGeometryEngine]; myPointReprojected = [ge projectGeometry:myPoint toSpatialReference:[AGSSpatialReference webMercatorSpatialReference]]; [myMarkerPointArray addObject:myPointReprojected]; }
AGSSpatialReference* ref = [AGSSpatialReference spatialReferenceWithWKID:4326]; AGSPoint* myMarkerPoint = [AGSPoint pointWithX:lng y:lat spatialReference:ref];
NSMutableArray *myMarkerPointArray = [[NSMutableArray alloc] init]; // note that textFileMgmt1.points returns an NSDictionary for ( NSDictionary *item in textFileMgmt1.points ) { AGSPoint *myPoint; myPoint = [AGSPoint pointWithX:[[item valueForKey:@"dict_x_long"] doubleValue] y:[[item valueForKey:@"dict_y_lat"] doubleValue] spatialReference:[AGSSpatialReference wgs84SpatialReference]]; AGSGeometry *myPointReprojected; AGSGeometryEngine *ge = [AGSGeometryEngine defaultGeometryEngine]; myPointReprojected = [ge projectGeometry:myPoint toSpatialReference:[AGSSpatialReference webMercatorSpatialReference]]; [myMarkerPointArray addObject:myPointReprojected]; }