Select to view content in your preferred language

Reproject a Polygon

2222
0
10-14-2014 12:41 PM
AaronNash1
Frequent Contributor

I am a little confused by the output of reprojecting a polygon. I have a polygon created from a series of map points and i need to reproject the polygon from web mercator to CT State plane NAD83. I am able to get results back from the geometry service but the output is not consistent and it appears to have slightly shifted the polygon. I use the same coordinate latitude for two points, and the same longitude for two points to draw a box. The returned polygon does not have 2 coordinates with the same longitude or 2 with the same latitude.

private function projectPolygon(polygon:Polygon):void

{

     const projParam:ProjectParameters = new ProjectParameters();

     projParam.geometries = [ polygon ];

     projParam.outSpatialReference = new SpatialReference(2234);

     geometryService.project(projParam, new AsyncResponder(project_resultHandlerPoly, project_faultHandlerPoly, polygon));

}

private function project_resultHandlerPoly(result:Object, token:Object = null):void

{

     if (result)

     {

          var polygon:Geometry = (result as Array)[0] as Polygon;

          //add it to an arraycollection for later use

          polygonResultAC[polygonResultAC.length - 1].polyState = polygon;

     }

}

private function project_faultHandlerPoly(fault:Fault, token:Object = null):void

{

     Alert.show(fault.faultString + "\n\n" + fault.faultDetail, "project Fault " + fault.faultCode);

}

0 Kudos
0 Replies