POST
|
Here's how I did it: Step 1: Add your coordinate translation function. See mine above. I added it to the MapManager.xml. I have it taking and returning a MapPoint which is just an x,y pair. Step 2: Add a mouse move event listener to the map. In the sample viewer this would be in MapManager.xml. In the config function add: map.addEventListener(MouseEvent.MOUSE_MOVE, mapMouseMove); Then make a mapMouseMove function: private function mapMouseMove(event:MouseEvent):void
{
var mapPoint:MapPoint = map.toMapFromStage(event.stageX, event.stageY);
mapPoint = UTMtoLATLON(mapPoint); //translate coordinates
SiteContainer.dispatchEvent(new AppEvent(AppEvent.SET_XY, false, false, mapPoint));
} I use a MapPoint object because it is provided by the API rather than make my own ordered pair object or send the x and y separately. The AppEvent SET_XY is dispatched to let the banner know to update. You'll also need to add the SET_XY event to AppEvent.as: public static const SET_XY:String = "setxyLoc"; Step 3: In your banner set an event listener for the SET_XY event and then set the [Bindable] x and y variables for your banner display using the data that was dispatched. In the Banner init: SiteContainer.addEventListener(AppEvent.SET_XY, setXY); Add a Banner setXY function: private function setXY(event:AppEvent):void
{
if (event.data)
var mapPoint:MapPoint = event.data as MapPoint;
xLoc = mapPoint.x.toFixed(6);
yLoc = mapPoint.y.toFixed(6);
} xLoc and yLoc are my bindable variables that are displayed in the banner for lat/long. There may be a better way to do this, but this way has been working great for me.
... View more
07-09-2010
07:47 AM
|
0
|
0
|
623
|
POST
|
It looks like you could take the code that you linked and make a function just like the one I posted. The code you posted takes an x and y in state plane, does all of the math and you end up with a lat, long. That should fit perfectly into a similar function in flex and then you can use the mouse move event to pass the x, y to your function and then the results of the function to the banner lat, long coordinates. Are you using the sample viewer, or making a custom application?
... View more
07-08-2010
11:33 AM
|
0
|
0
|
623
|
POST
|
Thanks, I knew it was simple but couldn't get brain to work right after the long weekend!
... View more
07-06-2010
07:59 AM
|
0
|
0
|
130
|
POST
|
Is the zoom slider on a map object movable? I'd like to put it on the right hand side of the screen instead of the left. It seems like this should be easy but maybe I'm just missing the obvious way to do it. I'm using the 1.3 API still. Thanks
... View more
07-06-2010
07:39 AM
|
0
|
2
|
303
|
POST
|
One easy way is to just specify the layers you do want to be included in the identify when you are setting your identify parameters: var identifyParams:IdentifyParameters = new IdentifyParameters();
identifyParams.layerIds = [58,59,60,61]; The layer numbers you specify correspond to the layer numbers you can find in the rest services directory for the service you are running the ID on.
... View more
07-01-2010
08:43 AM
|
0
|
0
|
93
|
POST
|
So, correct me if I am wrong, but wouldn't that mean I have to recompile the application every time we have to add or remove maptips for a layer, and then replace the application while hundreds of people are using it? You are talking about infopopup.mxml right? thanks for the reply!! Yes, I'm talking about infopopup.mxml. I did modify it a bit for our application, but it is an easy place to start from. As far as recompiling to add or remove maptips, I'm not quite sure what you mean but I don't think that would be necessary. The way we have it set up there is no need to recompile. The map tip returns the attributes for the top layer that is turned on in the map, and shows only the fields that are turned on in the map service. This way you can control what is in the map tip without having to make any changes in the code. If the field names in a layer in your map service aren't friendly, you can just use aliases in ArcMap. The way I look at it there are three parts: 1. Set up your map service so that the layers only have the fields that you want in your map tip turned on. You can also add code to filter out fields that need to be on for the service to work but you don't want in your map tip, like OBJECTID and Shape. 2. In your flex app, when the user clicks on the map (MapMouseEvent.MAP_CLICK) add the code to do an identify. You can write the identify code for different behaviors but we chose to return the top layer that is turned on. 3. Pass the results of the identify to the infoPopup. You can see examples of how to do this in the search widget or any other widget that uses the infoPopup to display a tooltip. The result looks like the attached image.
... View more
06-28-2010
07:10 AM
|
0
|
0
|
528
|
POST
|
We decided to go with the InfoPopup from the flex sample viewer. The user must click to get the maptip, so it's kind of like a cross between an identify tool and a maptip.
... View more
06-25-2010
01:08 PM
|
0
|
0
|
528
|
POST
|
Guys, Here is the solution.
//Add this to the init function
callLater(expandTOC);
//Add this function
private function expandTOC():void
{
toc.openItems = toc.dataProvider.source;
for each(var item:TocMapLayerItem in toc.openItems) {
if (item.isTopLevel())
toc.expandItem(item,true,true,true,null);
}
} Are you meaning the MapManager init? I tried adding this and nothing happens. EDIT: never mind I got this fixed! Since my TOC code wasn't in MapManager I had to move it!
... View more
06-25-2010
11:37 AM
|
0
|
0
|
289
|
POST
|
http://scfres09/arcgis/rest/services/My_map/MapServer
... View more
06-10-2010
01:16 PM
|
0
|
0
|
126
|
POST
|
I added the identify tool to my flex app (1.3 API) using code similar to the Identify widget in the sample viewer, and I have been having an issue where the fields are always returned in a random order. The order that the fields appear in the rest endpoint is what I'd like them to display as in the identify results. When I submit an identify request to the service through the rest endpoint, it always returns the fields in the same order. When I get the results using the identify code supplied by the Flex api they are always in a random order that changes each time you open the flex app. Is there a setting I can change in my flex code that will fix this or is it the API that does this? If it is in the API, is that considered a bug or a feature? Anyone know whether it still behaves in this manner in the new 2.0 api? Thank you!
... View more
06-07-2010
01:33 PM
|
0
|
1
|
2090
|
POST
|
Along the same lines, is there a way to get the Shape and OBJECTID fields to not show in the identify results? I turn off all of the other attributes I don't want in the results but those two will always show up since they have to be on. Our end users don't want to know the OBJECTID or whether or not something is a polygon.
... View more
05-28-2010
07:22 AM
|
0
|
0
|
314
|
POST
|
Kevin, thank you for the reply. I took a look at the <SchemaLockingEnabled> property of the service configuration and it seems like a good solution but I finally settled on using the AGSSOM tool inside a script in my model to stop and start the service while the overwrite is taking place (as suggested by Andrew in the ArcGIS Server General forum.) Here's a link to the AGSSOM tool for anyone interested in this functionality: http://resources.esri.com/arcgisserver/adf/dotnet/index.cfm?fa=codeGalleryDetails&scriptID=16293
... View more
04-22-2010
01:21 PM
|
0
|
0
|
732
|
Title | Kudos | Posted |
---|---|---|
2 | 07-25-2019 03:22 PM | |
1 | 09-15-2023 03:06 PM | |
1 | 09-05-2017 10:36 AM | |
2 | 08-08-2018 01:38 PM | |
4 | 12-19-2019 03:07 PM |
Online Status |
Offline
|
Date Last Visited |
09-15-2023
11:08 PM
|