I have been struggling with this code for a few days now and have not come to a resolution. What I am trying to do is reproject a geolocation event to display on a base map in a state plane projection. I would prefer to do the calculation on the client side but since I do not know the formula to go from WGS84 to CT State plane NAD83, I am stuck sending the request to my geometry service. I have tried almost everything I can think of (thats why I am posting), in debugging mode I can see the values (Lat and Long) being passed to the geometry service with the output spatial reference, but there are no values being returned. I have tried the ESRI geometry service and my own (which is server 9.3.1), but return no results. private function onTravel(event:GeolocationEvent):void
{
var long:String = event.longitude.toString();
var lat:String = event.latitude.toString();
var longnew:Number = Number(long);
var latnew:Number = Number(lat);
var GPSPoint:MapPoint = new MapPoint(longnew, latnew);
geoLat.text = event.latitude.toString();
geoLong.text = event.longitude.toString();
var graphic:Graphic = new Graphic(GPSPoint, GPSicon);
myGraphicsLayer.clear();
myGraphicsLayer.add(graphic);
var outSR:SpatialReference = new SpatialReference(2234);
geometryService.project([GPSPoint as Geometry], outSR);
}
private function projectCompleteHandler(event:GeometryServiceEvent):void
{
try
{
var pt:MapPoint = (event.result as Array)[0]as MapPoint;
reprojectLat.text = pt.x.toString();
reprojectLong.text = pt.y.toString();
}
catch (error:Error)
{
Alert.show(error.toString());
}
}
Here is the code I am using, instead of reprojecting the data to display on the map. I created a box on the map that would show the current X and Y and the reprojected X and Y, the map service I am using is in WGS 1984 and the GPS mappoint is displayed correctly on the map. I just cannot figure out why the geometry service is not returning any values...HELPthanks, Aaron