Select to view content in your preferred language

CoordinateMenu Widget

2419
7
Jump to solution
06-28-2012 06:06 AM
philippschnetzer
Frequent Contributor
Trying to recompile this widget for FV 3.0, not getting any errors but the widget hangs when you try to project a point.

Here;s my attempt to change the code in the Projector.as    ...can anyone see why this wouldn't work?

public function projectPoint(mapPoint:MapPoint, toWKID:Number, callbackFunction:Function, errorFunction:Function = null):void   {    this.geometryService = new GeometryService(this.geometryServiceURL);    this.geometryService.addEventListener(GeometryServiceEvent.PROJECT_COMPLETE, callbackFunction);    if (errorFunction != null)    {     this.geometryService.addEventListener(FaultEvent.FAULT, errorFunction);    }    else    {     this.geometryService.addEventListener(FaultEvent.FAULT, function():void     {      Alert.show("Error projecting coordinates.","Error");     });    }    var projParams:ProjectParameters = new ProjectParameters();    projParams.geometries = [MapPoint as Geometry];    projParams.outSpatialReference = new SpatialReference(toWKID);    // Note: GeometryService takes in geometries instead of graphics as input    geometryService.project(projParams);
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
PatrickMullen1
Occasional Contributor
Not a programmer but wouldn't you need to convert mapPoint and not MapPoit to a geometry.


var projParams:ProjectParameters = new ProjectParameters;
   projParams.geometries = [mapPoint as Geometry];
   projParams.outSpatialReference = new SpatialReference(toWKID);
   // Note: GeometryService takes in geometries instead of graphics as input
   geometryService.project(projParams);


This seems to be working for me.

View solution in original post

0 Kudos
7 Replies
PatrickMullen1
Occasional Contributor
Not a programmer but wouldn't you need to convert mapPoint and not MapPoit to a geometry.


var projParams:ProjectParameters = new ProjectParameters;
   projParams.geometries = [mapPoint as Geometry];
   projParams.outSpatialReference = new SpatialReference(toWKID);
   // Note: GeometryService takes in geometries instead of graphics as input
   geometryService.project(projParams);


This seems to be working for me.
0 Kudos
philippschnetzer
Frequent Contributor
That was it! *Facepalm

Thanks!
0 Kudos
RhettZufelt
MVP Notable Contributor
Was wondering if you got this working, and if so, if you would be kind enough to share the "modified" source?

Thanks,

R_
0 Kudos
PatrickMullen1
Occasional Contributor
Was wondering if you got this working, and if so, if you would be kind enough to share the "modified" source?

Thanks,

R_


The only file that needed to be changed for the widget was the Projector.as
0 Kudos
RhettZufelt
MVP Notable Contributor
Thank you.  I tried to make the changes to projector.as and got it to compile without errors or warnings, but was getting no response in the map.

Must have made a type somewhere, as it is working fine now using your projector file.

At least, the GUI is.  Do you have the context menu option functioning as well?

Thank you,

R_
0 Kudos
PatrickMullen1
Occasional Contributor
It appears to be working. I don't use this portion of the widget but I turned it on real quick to check. Remember to at the widget in the UI elements.

Here is the source code for everything. Let me know how it goes.

Patrick
0 Kudos
RhettZufelt
MVP Notable Contributor
Got it.  Thank you.

Turns out that I "disabled" it by following this thread:  http://forums.arcgis.com/threads/18142-remove-items-from-map-context-menu

Removed more than expected from the contect menu.

R_
0 Kudos