I am have problems with changing the project of the geoloaction to NAD 1983 California State Plan zone 3 in feet ???wkid 2227???. What am I missing.
import flash.sensors.Geolocation;
private var geo:Geolocation;
private function myMap_loadHandler(event:MapEvent):void
{
if (Geolocation.isSupported)
{
geo = new Geolocation();
zoomToCurrentLocationBtn.visible = !geo.muted;
geo.addEventListener(StatusEvent.STATUS, geo_statusHandler, false, 0, true);
}
}
private function geo_statusHandler(event:StatusEvent):void
{
zoomToCurrentLocationBtn.visible = !geo.muted;
if (geo.muted)
{
myLocationGraphic.visible = false;
}
}
private function zoomToCurrentLocation_clickHandler(event:MouseEvent):void
{
busyIndicator.visible = true;
zoomToCurrentLocationBtn.enabled = false;
geo.addEventListener(GeolocationEvent.UPDATE, geo_updateHandler);
}
private function geo_updateHandler(event:GeolocationEvent):void
{
busyIndicator.visible = false;
zoomToCurrentLocationBtn.enabled = true;
geo.removeEventListener(GeolocationEvent.UPDATE, geo_updateHandler);
if (isNaN(event.longitude) || isNaN(event.longitude))
{
// values are NaN in Airplane mode
myLocationGraphic.visible = false;
}
else
{
// convert the longitude and latitude values to web mercator as the basemap is in web mercator
// var currentLocation:MapPoint = new WebMercatorMapPoint(event.longitude, event.latitude);
// var outSR2:SpatialReference = new SpatialReference(wkid.selectedItem.data);
// var currentLocation:MapPoint = new MapPoint(event.longitude, event.latitude, outSR2);
var long:String = event.longitude.toString();
var lat:String = event.latitude.toString();
var longnew:Number = Number(long);
var latnew:Number = Number(lat);
//var currentLocation:MapPoint = new MapPoint(event.longitude, event.latitude);
var currentLocation:MapPoint = new MapPoint(longnew,latnew,outSR2);
//currentLocation.spatialReference = new SpatialReference(4326);
var outSR2:SpatialReference = new SpatialReference(4326);
var projParams:ProjectParameters = new ProjectParameters();
projParams.geometries = [currentLocation];
outSR2= new SpatialReference(2227);
projParams.outSpatialReference = outSR2;
geometryService.project(projParams);
// show.text = longnew.toString();
// var outSR:SpatialReference = new SpatialReference(2234);
// geometryService2.project(event.longitude, event.latitude, outSR);
// geometryService2.projectLastResult(currentLocation,outSR);
// outSR= new SpatialReference(3414);
// geometryService.project(projectParameters);
// currentLocation.spatialReference = new SpatialReference(2227);
// show and zoom to current location
myLocationGraphic.geometry = currentLocation;
myLocationGraphic.visible = true;
myMap.centerAt(currentLocation);
myMap.level = 8;
}
}
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<esri:GeometryService id="geometryService2"
concurrency="last"
fault="geometryService_faultHandler(event)"
projectComplete="projectCompleteHandler(event)"
showBusyCursor="true"
url="http://stangis/arcgis/rest/services/Utilities/Geometry/GeometryServer"/>
<esri:GeometryService id="geometryService" concurrency="last" fault="geometryService_faultHandler(event)" projectComplete="projectCompleteHandler(event)"
url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/>
</fx:Declarations>
ThanksAron Public Works/GIS CentralStanislaus County