POST
|
Robert, Yes there must be something else at play, and it may be that this can only work within the mxml component. I am trying to do this in an action script class, and it never sends to the geometry service. So I guess I may create a new post to see if it is possible to use a geometry service in an action script class, i.e. not in mxml. Thanks again for the help. Jim Faron Austin Independent School District
... View more
08-30-2013
12:08 PM
|
0
|
0
|
116
|
POST
|
Robert, I input the Spatial Reference, and that will definitely fix the error when I input the url send to the geometry server: it will reproject there as expected. But the action script never sends to the geometry server, i.e. when I debug it will skip through the function pResult. In other words I can't seem to get the action script to complete the request, thus not even a fault will return (i.e when I previously forgot the input spatial reference). Here is the code: public function convertToPoint(x:Number, y:Number, bool:Boolean):Point
{
var _pointObject:MapPoint = new MapPoint();
_pointObject.spatialReference = new SpatialReference(4326);
_pointObject.x = x;
_pointObject.y = y;
if((bool) && (!isNaN(x)) && (!isNaN(y)))
{
//_pointObject = WebMercatorUtil.geographicToWebMercator(_pointObject) as MapPoint;
var geomServ:GeometryService = new GeometryService("https://my-imap.austinisd.org/arcgis/rest/services/Utilities/Geometry/GeometryServer");
//geomServ.addEventListener(GeometryServiceEvent.PROJECT_COMPLETE,pResult);
const projParams:ProjectParameters = new ProjectParameters();
projParams.geometries = [_pointObject ];
var outSR:SpatialReference = new SpatialReference(2277);
projParams.outSpatialReference = outSR;
geomServ.project(projParams,
new AsyncResponder(
function pResult(item:Object, token:Object = null):void{
var pt:MapPoint = (item as Array)[0] as MapPoint;
_pointObject.x = pt.x;
_pointObject.y = pt.y;
},
function pFault(fault:Fault, token:Object = null):void{
Alert.show("Error: " + fault.faultString, "Error code: " + fault.faultCode);
}
)
);
} Here is the url that would be sent: https://my-imap.austinisd.org/arcgis/rest/services/Utilities/Geometry/GeometryServer/project?outSR=2277&f=json&geometries={%22geometryType%22%3A%22esriGeometryPoint%22%2C%22geometries%22%3A[{%22x%22%3A-97.75055769%2C%22y%22%3A30.22752472}]}&inSR=4326 The return from the geometry server: {"geometries":[{"x":3112207.5068722428,"y":10055955.767591864}]} So I wonder if this is an action script issue, since all of this would work easily in mxml. Thanks, Jim Faron Austin Independent School District
... View more
08-30-2013
11:23 AM
|
0
|
0
|
116
|
POST
|
Robert, Here is the code I am using: public function convertToPoint(x:Number, y:Number, bool:Boolean):Point
{
var _pointObject:MapPoint = new MapPoint();
_pointObject.x = x;
_pointObject.y = y;
if((bool) && (!isNaN(x)) && (!isNaN(y)))
{
//_pointObject = WebMercatorUtil.geographicToWebMercator(_pointObject) as MapPoint;
var geomServ:GeometryService = new GeometryService("https://my-imap.austinisd.org/arcgis/rest/services/Utilities/Geometry/GeometryServer");
//geomServ.addEventListener(GeometryServiceEvent.PROJECT_COMPLETE,pResult);
const projParams:ProjectParameters = new ProjectParameters();
projParams.geometries = [_pointObject as MapPoint ];
var outSR:SpatialReference = new SpatialReference(2277);
projParams.outSpatialReference = outSR;
geomServ.project(projParams,
new AsyncResponder(
function pResult(item:Object, token:Object = null):void{
var pt:MapPoint = (item as Array)[0] as MapPoint;
_pointObject.x = pt.x;
_pointObject.y = pt.y;
},
function pFault(fault:Fault, token:Object = null):void{
Alert.show("Error: " + fault.faultString, "Error code: " + fault.faultCode);
}
)
);
} The url that forms (from debug) is http://mapaisd/arcgis/rest/services/Utilities/Geometry/GeometryServer/project?outSR=2277&f=json&geometries=%7B%22geometryType%22%3A%22esriGeometryPoint%22%2C%22geometries%22%3A%5B%7B%22y%22%3A30%2E49213059%2C%22x%22%3A%2D97%2E64269802%7D%5D%7D This returns {"error":{"code":400,"message":"Unable to complete operation.","details":[]}} if I input it in the browser. Thanks, Jim Faron Austin Independent School District
... View more
08-30-2013
08:37 AM
|
0
|
0
|
343
|
POST
|
Robert, That does formulate the send request to the geometry service as expected, but it does not actually send it, at least as I can tell from monitoring it with fiddler. I stepped through this in debug and it forms the url request to the geometry server. But the item:Object never gets a value returned from the geometry server, and it basically skips through both the pResult and the pFault functions. Seems to be related to the problem regarding dispatching events that is referred to in the adobe blog post I linked in my first post. Thanks, Jim Faron Austin Independent School District
... View more
08-30-2013
08:19 AM
|
0
|
0
|
343
|
POST
|
I have used something similar in mxml, but I am trying to do a reprojection in an action script class, and the event listener will not fire within the function. Here is the orginal code: public function convertToPoint(x:Number, y:Number, bool:Boolean):Point
{
var _pointObject:MapPoint = new MapPoint();
_pointObject.x = x;
_pointObject.y = y;
if(bool)
{
_pointObject = WebMercatorUtil.geographicToWebMercator(_pointObject) as MapPoint;
}
else
{
_pointObject = WebMercatorUtil.webMercatorToGeographic(_pointObject) as MapPoint;
}
return new Point(_pointObject.x, _pointObject.y);
} I have tried creating a class to project the _pointObject to state plane, but first I tried something like this (this is a simplified version of what I tried, but the essence is that I can't get the event listener to dispatch the result function) I had the same issue in the class I created : public function convertToPoint(x:Number, y:Number, bool:Boolean):Point
{
var _pointObject:MapPoint = new MapPoint();
_pointObject.x = x;
_pointObject.y = y;
if(bool)
{
//_pointObject = WebMercatorUtil.geographicToWebMercator(_pointObject) as MapPoint;
var geomServ:GeometryService = new GeometryService("http://myserver/arcgis/rest/services/Utilities/Geometry/GeometryServer");
geomServ.addEventListener(GeometryServiceEvent.PROJECT_COMPLETE,pResult);
const projParams:ProjectParameters = new ProjectParameters();
projParams.geometries = [_pointObject as MapPoint ];
var outSR:SpatialReference = new SpatialReference(2277);
projParams.outSpatialReference = outSR;
geomServ.project(projParams);
function pResult(event:GeometryServiceEvent):void{
var pt:MapPoint = (event.result as Array)[0]as MapPoint;
_pointObject.x = pt.x;
_pointObject.y = pt.y;
} The code will work up to the geomServ.project(projParams) function, but the project comple function (pResult) will not fire up to complete the projection. I believe that there is an inherent issue with event listeners in action script, and I may be out of luck: I just wanted to bounce this off more experienced programmers. As I implied in my first post, it would be fantastic if we had a way to do something like this since many folks are either stuck with using state plane, or choose to for other reasons. By the time this data gets back to the mxml, it is buried in a complex graphic provider of a graphics layer, making re-projection in mxml a very difficult or unlikely prospect. The idea is to get to this data before it gets loaded into that graphicprovider. Thanks, Jim Faron Austin Independent School District
... View more
08-29-2013
06:12 PM
|
0
|
0
|
343
|
POST
|
Resurrecting this old post, due to my desire to use a geometry service in action script. The problem is that the listener event will not dispatch the geometry service project_complete function, i.e. "pResult". This post describes the problem of dispatching an event in action script:http://blogs.adobe.com/steampowered/2011/05/dispatching-events-from-an-actionscript-class.html Just wondering if anyone has succeeded to use a geometry service in action script. I'm trying to modify a function to project to State Plane that currently uses the WebMercatorUtil. Also found this for Silverlight that auto-reprojects grahic layers, something that relates to my issue, in that I am stuck with trying to use a State Plane projected map with a graphics layer that is produced by a complex process: http://blogs2.esri.com/esri/arcgis/2011/02/13/auto-reprojecting-graphics-layers/ Thanks, Jim Faron Austin Independent School District
... View more
08-29-2013
01:44 PM
|
0
|
0
|
343
|
POST
|
I am using Robert's revision of Chen's MapProgressBar widget. I have a tiled mapservice layer (parcels) that has a max scale of 1:8,000. When I zoom in and that layer activates, the progress bar disappears as expected, but when I zoom out beyond the max scale of the parcels layer, the progress bar hangs. I think that it has to do with the following code: protected function layerUpdateEndHandler(event:LayerEvent):void
{
var lyr:Layer = event.layer;
//once a layer finished its update,remove the layer from layer collection
if (layerColl.contains(lyr)){
layerColl.removeItemAt(layerColl.getItemIndex(lyr));
}
//all layers finished their loading and rendering,hide the progress
pb.visible = !layerColl.length == 0;
trace(layerColl.length);
} The protected function is supposed to iterate with each layer in the layerColl, but for some reason (since the layer in question is no longer in the refreshed map?), the layerUpdateEndHandler does not run to remove that layer, thus the condition pb.visible = !layerColl.length ==0 is still in effect, since layerColl still contains the parcels layer. In other words, if a layer is removed as the result of an extent change, it does not seem to activate the mapLayerRemoveHandler, since it is not registered by the MapEvent.LAYER_REMOVE event??? I hope my explanation is clear. Any help will be greatly appreciated. Thanks, Jim Faron
... View more
06-01-2012
11:35 AM
|
0
|
0
|
492
|
POST
|
Robert, Another issue with the tiled service: even though I can eventually move the layer up or down in the list (after the initial drop to the bottom as in the screen shot), when I test the visibility, I find that the layer's visibility doesn't actually move, i.e. the service displays on the map in the same order as in the configuration file, regardless of where it is in the TOC. Thanks, Jim Faron
... View more
02-23-2012
12:40 PM
|
0
|
0
|
468
|
POST
|
Robert, I've never used the layerListWidget, but just to be sure I removed it from Flex Modules list. The behavior in the TOC is still as described in the original post. I also made sure that layerlist visible was set to false in the eMapSwitcher and MapSwitcher widget xml. Thanks, Jim Faron
... View more
02-23-2012
10:54 AM
|
0
|
0
|
468
|
POST
|
I'm using Robert's TOC widget, on GIS server version 10.01, flex 2.5, uncompiled. When I first click 'Move down' from the menu on a layer, or Move up, instead of moving down or up one step in the TOC list, it goes to the bottom of the widget, separated from the other layers, as in the attached screen-shot. These layers are all tiled, i.e. not dynamic. The first screen shot is TOC when first opened, the second is TOC after moving down the Elementary Boundaries. Thanks, Jim Faron
... View more
02-23-2012
10:35 AM
|
0
|
8
|
908
|
POST
|
Robert, Great work once again: my application now loads as expected. What was odd about this was that it would randomly load as expected (mostly the first time, in Firefox, not IE), but on subsequent application loads it would default to the tiles of the lowest scale, in my case, level 8, as opposed to level 0, corresponding to full extent. The map would be centered regardless. Sometimes, if I cleared the cache, it would load correctly for that one time. Thanks, Jim Faron
... View more
10-05-2011
02:25 PM
|
0
|
0
|
291
|
POST
|
Robert, That was it! Thanks again for all of your help. Jim Faron
... View more
09-22-2011
05:30 AM
|
0
|
0
|
425
|
POST
|
Robert, In the Dynamic Legend widget init, I have it as follows: AppEvent.addListener(AppEvent.DATA_PUBLISH, sharedDataUpdated);
AppEvent.addListener(AppEvent.DATA_SENT, sharedDataUpdated2);
fetchSharedData(); Thanks, Jim Faron
... View more
09-22-2011
04:47 AM
|
0
|
0
|
425
|
POST
|
Robert, Thanks for the advice, but I can't seem to get the necessary exchange of data to happen. I added: private function incLegend():void
{
if(incLgnd.selected)
{
addSharedData("Legend_exportImage",null);
var id:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Dynamic Legend");
var bWidget:IBaseWidget = ViewerContainer.getInstance().widgetManager.getWidget(id,true) as IBaseWidget; and then in the Dynamic Legend added: private function sharedDataUpdated2(event:AppEvent):void
{
var dataTable:Hashtable = event.data as Hashtable;
if(dataTable.containsKey("Legend_exportImage"))
{
exportImage();
}
} When I debug, the dataTable key in the SharedDataUpdated2 is null. I fire the event listeners on init in the Dyanamic Legend. Thanks, Jim Faron
... View more
09-21-2011
01:29 PM
|
0
|
0
|
586
|
POST
|
Robert, I am encountering a problem with getting the base widget returned. I have set up function triggered by a checkbox in the Print widget to include the Dynamic Legend. The Dynamic Legend opens as expected, but the code if(bWidget) returns null when I debug, and of course anything after it does not happen. Here is the code I am using private function incLegend():void
{
if(incLgnd.selected)
{
var id:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Dynamic Legend");
var bWidget:IBaseWidget = ViewerContainer.getInstance().widgetManager.getWidget(id,true) as IBaseWidget;
if(bWidget){
var vSW:* = bWidget;
vSW.exportImage();} Is there something basic that I am missing? Thanks, Jim Faron
... View more
09-21-2011
09:41 AM
|
0
|
0
|
586
|
Title | Kudos | Posted |
---|---|---|
1 | 03-09-2023 07:05 AM | |
1 | 06-25-2021 08:54 AM | |
1 | 06-25-2021 08:35 AM | |
1 | 06-27-2022 02:18 PM | |
7 | 06-24-2021 03:26 PM |
Online Status |
Offline
|
Date Last Visited |
04-13-2023
10:27 AM
|