FlexAPI 2.1 Question:
Does anyone have some code that they could share to convert coordinates (for example a single mappoint) from State Plane/and or UTM to decimal degrees (i.e. wkid 4326)? The Web Mercator utilities are great for doing this on the client side, but unfortunately not all of my services are in Web Mercator.
I imagine this require a trip back and forth between the server. I just haven't found a sample of that yet.
Thanks for your help!
Frank
Code currently looks as follows:
const mapPoint:MapPoint = map.toMapFromStage(event.stageX, event.stageY);
var latlong:MapPoint;
var wkidString:String = mapPoint.spatialReference.wkid.toString();
//Alert.show(mapPoint.spatialReference.wkid.toString());
if ( wkidString == "102100")
{
latlong = WebMercatorUtil.webMercatorToGeographic(mapPoint) as MapPoint;
}
else if ( wkidString == "3857")
{
latlong = WebMercatorUtil.webMercatorToGeographic(mapPoint) as MapPoint;
}
else if ( wkidString == "4326")
{
latlong = map.toMapFromStage(event.stageX, event.stageY);
}
else
{
Alert.show("This widget will not work with data in this projection");
}
frLat = latlong.y.toFixed(6);
frLong = latlong.x.toFixed(6);