Using Lambert Azimuthal Equal Area projection in iOS

2061
2
02-29-2012 03:25 PM
PeterErickson
New Contributor
Hi,

I'm trying to use Lambert Azimuthal Equal Area projection as an AGSSpatialReference.  I've tried using WKID 102017 for North_Pole_Lambert_Azimuthal_Equal_Area, but the data seems to always project the same as when the WKID is set to 4326.

I'm using AGSGraphicsLayer and AGSMutablePolyline to draw a shape to see the effect of using different WKID/WKT for projections, but can't get anything to change.  What am I missing?

Thanks for your help!!
Peter
0 Kudos
2 Replies
PeterErickson
New Contributor
I just wanted to supplement my question with some code that I'm trying to use to help explain the trouble I'm having.

        AGSSpatialReference *sr = [[AGSSpatialReference alloc] initWithWKID:102017 WKT:@"PROJCS[\"North_Pole_Lambert_Azimuthal_Equal_Area\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"False_Easting\",0],PARAMETER[\"False_Northing\",0],PARAMETER[\"Central_Meridian\",-95],PARAMETER[\"Latitude_Of_Origin\",40],UNIT[\"Kilometer\",1000]]"];
        
        AGSEnvelope *env = [AGSEnvelope envelopeWithXmin:-2500
                                                ymin:-1500
                                                xmax:2500
                                                ymax:1500
                                    spatialReference:sr];
        
        AGSGraphicsLayer* glayer = [AGSGraphicsLayer graphicsLayer];
        glayer.initialEnvelope = env;
        
        UIView<AGSLayerView>* lyrView = [self.mapView addMapLayer:glayer withName:@"Graphics Layer"];
        
        AGSMutablePolyline *poly = [[AGSMutablePolyline alloc] initWithSpatialReference:sr];
        [poly addPathToPolyline];
        // points add to the polyline
    
        AGSSymbol* s = [[AGSSimpleLineSymbol alloc] initWithColor:[UIColor redColor] width:10.0f];
        AGSGraphic* g = [[AGSGraphic alloc] initWithGeometry:poly symbol:s attributes:nil infoTemplateDelegate:nil];
        
        [glayer addGraphic:g];
        [glayer dataChanged];


It's unclear to me what units the AGSEnvelope should be in... kilometers?

It was from these pages that I got information about the WKID/WKT for this projection: http://wikis.esri.com/wiki/display/mobileSDK/mobilepcs, and http://spatialreference.org/ref/esri/102017/esriwkt/.

However, the AGSGeometry.h API page it makes me unsure if this project is actually support by the iOS SDK.

Any help would be greatly appreciated!
Peter
0 Kudos
NimeshJarecha
Esri Regular Contributor
The unit is Meter for the spatial reference 102017. Also, you don't need both WKID and WKT string to create the AGSSpatialReference. Now, you know that should be the values of your AGSEnvelope.

Do you just have graphics layer in your map? or You've any other base map layer? If yes, the graphics layer will re-projected based on base layer's spatial reference.

Regards,
Nimesh
0 Kudos