|
POST
|
Use the WGS_1984_Web_Mercator which is wkid 102113 and is compatible with 102100. There was a thread a while discussing this, but I forget where it is now, but I don't think there is an explicit 102100 in ArcMap.
... View more
07-29-2010
09:23 AM
|
0
|
0
|
781
|
|
POST
|
I use GraphicsLayer for miscellaneous selections, more like stuff where I just want to see a boundary, but don't care too much about the data behind it except maybe a name. I use the FeatureLayer for a couple of items where I can leverage the RelationshipQuery to easily pull in detailed data. I can't tell you how much easier this has made pulling detailed data from SDE tables for me. Previously, I would have had to use a WebService/RemoteObject to hit the SDE directly for table queries. Now that we have access to AMF in the QueryTask which is built into FeatureLayer, it's cut my service calls down drastically. When you do a selection using a FeatureLayer it returns an array of graphics, each with an attribute field. So when I do this
AsyncToken(fLayer.selectFeatures(query, "new", new AsyncResponder(response, onFault)));
I use this
[Bindable]
featuresColl:ArrayCollection; // bind this to a DataGrid dataprovider
private function response(features:Array, token:Object = null):void {
var f:Array = extractAttributesFromFeatures(features); // for loop in previous post
featuresColl = new ArrayCollection(f);
}
Graphics in the FeatureLayer are automatically show on your map and also stored in flayer.selectedFeatures So in comparison flayer.selectedFeatures is equivalent to featureSet.features but there doesn't seem to be an equivalent pointer to featureSet.attributes. I imagine this might be for performance reasons to keep Featurelayer efficient. You can review the FeatureLayerEvent which is the result when using queries with FeatureLayer to see some options http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/events/FeatureLayerEvent.html You can see the features array in there and you can also see that you get a FeatureSet when you use fLayer.queryFeatures, but a regular query doesn't show the graphics on the map automatically.
... View more
07-28-2010
07:13 AM
|
0
|
0
|
1176
|
|
POST
|
Is your ArcGIS Server version 10? Using a FeatureLayer, you can only get symbology back from AGS10. I had this issue when I started using FeatureLayer's before I upgraded my server.
... View more
07-27-2010
02:36 PM
|
0
|
0
|
1128
|
|
POST
|
You're a lifesaver Dasa. Chaning to ROLL_OUT/ROLL_OVER works great. Can't believe I didn't check event targets. Thanks again.
... View more
07-27-2010
12:06 PM
|
0
|
0
|
423
|
|
POST
|
I'm still not 100% clear on FeatureLayers purpose. It would seem looking at examples it's usefulness is really for editing and time-aware data. I'm sure they've covered it in more detail somewhere, but I may have missed it. If you review this sample, you'll see a quick note about FeatureCollection for FeatureLayer that states you should initialize FeatureCollection on your own. So it's not useful for data binding results of a query. http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=TemporalRenderer_FeatureCollection So far the method I have been using to extract attributes from a FeatureLayer is manually.
protected function extractAttributesFromFeatures(features:Array):Array {
var f:Array = [];
var g:Graphic;
for each (g in features) {
f.push(g.attributes);
}
return f;
}
Then you can set that result to a Datagrid dataprovider.
... View more
07-27-2010
11:41 AM
|
0
|
0
|
1176
|
|
POST
|
There are a couple of ways to approach it, but you are very close. Because you have the {theRpageLink} inside single quotes, it thinks that's the exact string you want to send. If you do new URLRequest(theRpageLink); that should work if theRpageLink is a well formed URL string. If you are using the infoWindowRender you should be able to pass the string directly. <esri:infoWindowRenderer>
<fx:Component>
<mx:VBox backgroundColor="0xffffff"
color="0x444444"
label="Parcel {data.PARCELID}">
<mx:Label text="URL: {data.Rpage}" click="theRpage_clickHandler(data.Rpage)"/>
</mx:VBox>
</fx:Component>
</esri:infoWindowRenderer>
private function theRpage_clickHandler(url:String):void
{
var theRpageURL:URLRequest = new URLRequest(url);
navigateToURL(theRpageURL, "_blank");
}
I haven't tested this example, but it should work.
... View more
07-26-2010
01:03 PM
|
0
|
0
|
871
|
|
POST
|
The docs don't mention how to really use this, but based on the comments in this thread, it looks like you set FeatureCollection yourself to use with time-aware data. Here is a sample http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=TemporalRenderer_FeatureCollection It looks like you could basically load up any FeatureSet or LayerDetails into the FeatureCollection. I don't think you'd be limited to time-aware data.
... View more
07-22-2010
11:09 AM
|
0
|
0
|
305
|
|
POST
|
I have a function in my application similar to this oldie, but goodie from the dev blog. I simply add eventListeners for mouseOver and mouseOut on the graphics in a FeatureLayer's selectedFeatrues array. My function works great with Polyline, but when working with points, it would appear I have 2 graphic features for each MapPoint. In my logs, defaultSymbol is the target Symbol that I will save default symbology. highlight is the mouseOver event and reset is mouseOut event. Here is the log for mouseOver and mouseOut on a selected line a FeatureLayer highlight: geometry of cuurentTarget: (com.esri.ags.geometry::Polyline)#0
13:40:42.926->org.lacsd.util.LayerUtil->highlight: defaultSymbol before being set: null
13:40:42.926->org.lacsd.util.LayerUtil->highlight: current symbol of graphic: null
13:40:42.926->org.lacsd.util.LayerUtil->highlight: defaultSymbol after being set: null
13:40:42.926->org.lacsd.util.LayerUtil->highlight: current symbol of graphic after set: [object SimpleLineSymbol]
reset: geometry of cuurentTarget: (com.esri.ags.geometry::Polyline)#0
13:40:43.301->org.lacsd.util.LayerUtil->reset: defaultSymbol before being set: null
13:40:43.301->org.lacsd.util.LayerUtil->reset: current symbol of graphic: [object SimpleLineSymbol]
13:40:43.301->org.lacsd.util.LayerUtil->reset: defaultSymbol after being set: null
13:40:43.301->org.lacsd.util.LayerUtil->reset: current symbol of graphic after set: null Here is the log for exact same action on a MapPoint graphic. 13:42:53.204->org.lacsd.util.LayerUtil->highlight: geometry of cuurentTarget: MapPoint[x=-13124667.797324661,y=4029073.938918875,SpatialReference[102113]]
13:42:53.204->org.lacsd.util.LayerUtil->highlight: defaultSymbol before being set: [object Symbol]
13:42:53.204->org.lacsd.util.LayerUtil->highlight: current symbol of graphic: null
13:42:53.204->org.lacsd.util.LayerUtil->highlight: defaultSymbol after being set: null
13:42:53.204->org.lacsd.util.LayerUtil->highlight: current symbol of graphic after set: [object SimpleMarkerSymbol]
13:42:53.235->org.lacsd.util.LayerUtil->highlight: geometry of cuurentTarget: MapPoint[x=-13124667.797324661,y=4029073.938918875,SpatialReference[102113]]
13:42:53.235->org.lacsd.util.LayerUtil->highlight: defaultSymbol before being set: null
13:42:53.235->org.lacsd.util.LayerUtil->highlight: current symbol of graphic: [object SimpleMarkerSymbol]
13:42:53.235->org.lacsd.util.LayerUtil->highlight: defaultSymbol after being set: [object SimpleMarkerSymbol]
13:42:53.235->org.lacsd.util.LayerUtil->highlight: current symbol of graphic after set: [object SimpleMarkerSymbol]
13:42:53.454->org.lacsd.util.LayerUtil->reset: geometry of cuurentTarget: MapPoint[x=-13124667.797324661,y=4029073.938918875,SpatialReference[102113]]
13:42:53.454->org.lacsd.util.LayerUtil->reset: defaultSymbol before being set: [object SimpleMarkerSymbol]
13:42:53.454->org.lacsd.util.LayerUtil->reset: current symbol of graphic: [object SimpleMarkerSymbol]
13:42:53.454->org.lacsd.util.LayerUtil->reset: defaultSymbol after being set: [object SimpleMarkerSymbol]
13:42:53.454->org.lacsd.util.LayerUtil->reset: current symbol of graphic after set: [object SimpleMarkerSymbol] As you can see above, the mouseOver event fires twice. The odd part is the mouse out event only fires once. I've checked the FeatureLayer.selectedFeatures and the FeatureLayer.graphicProvider just in case, but can find no discrepency in graphic counts. Has anyone else run across a problem like this? This problem does not occur if I set the FeatureLayer.renderer manually, but I would like to see my mxd symbology before resorting to this. The problem it causes in my case is that the second mouseOver event sets the defaultSymbol to the highlighted symbol, so it never goes back to normal. I can work around this, but I'd like to know if there is something I'm missing or is this a feature somehow. Also, can anyone recreate it? Thanks. Here is my code if it makes a difference.
// add my listeners in a function
graphic.addEventListener(MouseEvent.MOUSE_OVER, highlightGraphic, false, 0, true);
graphic.addEventListener(MouseEvent.MOUSE_OUT, resetGraphic, false, 0, true);
// highlights the graphic
protected static function highlightGraphic(event:MouseEvent):void {
logger.debug("highlight: geometry of cuurentTarget: {0}", event.currentTarget.geometry);
logger.debug("highlight: defaultSymbol before being set: {0}", defaultSymbol);
logger.debug("highlight: current symbol of graphic: {0}", event.currentTarget.symbol);
// save the default symbology for the mouseOut
defaultSymbol = event.currentTarget.symbol;
// a class that pulls in preset highlight symbology based
// on geometry
event.currentTarget.symbol = highlight.getSymbol(event.currentTarget as Graphic);
logger.debug("highlight: defaultSymbol after being set: {0}", defaultSymbol);
logger.debug("highlight: current symbol of graphic after set: {0}", event.currentTarget.symbol);
}
// resets the graphic to original state
protected static function resetGraphic(event:MouseEvent):void {
logger.debug("reset: geometry of cuurentTarget: {0}", event.currentTarget.geometry);
logger.debug("reset: defaultSymbol before being set: {0}", defaultSymbol);
logger.debug("reset: current symbol of graphic: {0}", event.currentTarget.symbol);
// set the graphic symbology to original state
// using saved default symbology
event.currentTarget.symbol = defaultSymbol;
logger.debug("reset: defaultSymbol after being set: {0}", defaultSymbol);
logger.debug("reset: current symbol of graphic after set: {0}", event.currentTarget.symbol);
}
... View more
07-21-2010
01:36 PM
|
0
|
2
|
919
|
|
POST
|
If you want a clickable link, you'll want to set up the labelFunction of the DataGrid, which would look something like this protected function formatURL(item:Object, column:DataGridColumn):String {
column.itemRenderer = null;
if (column.dataField == "URLData" ) {
column.itemRenderer = new ClassFactory(UrlLinkButton);
return item.URLData;
}
else if (column.dataField == "Name") // set up checks for other field names
return item.Name;
else
return "ERR: No Field name defined";
} With an ItemRenderer for your field that could look like this. <?xml version="1.0" encoding="utf-8"?>
<mx:LinkButton xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
fontWeight="bold"
color="#0000FF"
label="{data.URLData}"
click="openURL()">
<fx:Script>
<![CDATA[
/**
* Function that will parse current date and given URL info into a url string to be opened in a new page.
**/
protected function openURL():void {
trace("button clicked, attempt to parse to URL");
if (data.URLData) {
// concatenate url string
var url:String = "url information" + data.URLData + "maybe more url information";
trace("send drawing url request");
navigateToURL(new URLRequest(url));
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</mx:LinkButton> This way, the URL opens only if they click in that field. Of course you could bypass the ItemRenderer and use the openURL() on an ItemClickEvent if you don't mind that the URL will open when they click the row in the DataGrid.
... View more
07-20-2010
09:16 AM
|
0
|
0
|
315
|
|
POST
|
Training from the source is on my list, adding the Flex 4 bible as well. Thanks. Two that I have gotten a lot of use from are Flex 4 In Action, print not available yet, but you can get the eBook, and I keep the Flex 4 Cookbook open pertty much all day.
... View more
07-20-2010
05:45 AM
|
0
|
0
|
751
|
|
POST
|
I'm having a little difficulty trying to make this work in a simple manner using a FeatureLayer. I'm able to use fLayer.selectFeatures() to make a selection, and features are highlighted on my map. problem I'm having now is trying to easily extract the attribute data. fLayer.selectedFeatures has all the graphics. I tried fLayer.featureCollection.featureSet.attributes, but featureCollection is null when using selectedFeatures. I'm guessing this would get populated when using fLayer.queryFeaturs() maybe? But then my selection doesn't show up. This is what I'm trying to do. fLayer.mode=FeatureLayer.MODE_SELECTION;
fLayer.selectionColor=0x7FFF00;
fLayer.outFields = [ "AssetID", "FeatureID", "Name" ];
fLayer.useAMF=true;
flayer.selectFeatures(query, "new", new AsyncResponder(onFeatureLayerResults_handler, onFault, true)));
function onFeatureLayerResults_handler(features:Array, token:Object = null):void {
// In some way set the dataprovider for a List/Datagrid to the attributes of fLayer
// I can iterate the graphics and grab their attributes, but was wondering if there
// was an easier method
} I haven't had much opportunity to use FeatureLayer up to now as I just got all Desktop/Server running ArcGIS 10, so maybe I'm approaching this the wrong way.
... View more
07-19-2010
01:51 PM
|
0
|
0
|
2160
|
|
POST
|
Well, that's much simpler than my initial approach 😮 In my example above, it's probably simpler making your own ScaleBar, add it to the StaticLayer, print, then remove it. Probably three extra lines of code as opposed to that massive loop I had. Dasa, if I wanted to change the size of the scalebar used outside the map, that can be done with a new Skin correct?
... View more
07-16-2010
11:25 AM
|
0
|
0
|
1387
|
|
POST
|
You can make a new Scalebar, copy it's attributes and place it in the footer or anywhere else on your map. You'd need create a new scalebar skin, which I have not done yet, but ESRI provides the current skins with the API, which is a big help. This is because you need to scale the scalebar to the print page size and just setting the height/width doesn't work. Granted, I have not gotten this far though, so not sure. To copy the scalebar, you can do something like this.
var i:uint = 0;
var x:uint = map.staticLayer.numChildren;
for (i; i < x; i++) {
trace("What is this object? {0}", map.staticLayer.getChildAt(i));
if (map.staticLayer.getChildAt(i) is ScaleBar) {
trace("found the scale bar!");
var s:ScaleBar = new ScaleBar();
s.map = (map.staticLayer.getChildAt(i) as ScaleBar).map;
s.lengthMetric = (map.staticLayer.getChildAt(i) as ScaleBar).lengthMetric;
s.lengthUS = (map.staticLayer.getChildAt(i) as ScaleBar).lengthUS;
s.textMetric = (map.staticLayer.getChildAt(i) as ScaleBar).textMetric;
s.textUS = (map.staticLayer.getChildAt(i) as ScaleBar).textUS;
// you can adjust the bottom/left/top/right values of the map scalebar too
s.bottom = 25;
s.left = 5;
this.addElement(s);
}
}
I copied the attributes of the scalebar, rather than copy it because if I do change the skin or figure out how to scale it, passing it would be reflected in the scalebar on the map, so make sure you copy it. That's as far as I've gotten so far. I'd love to hear some other solutions. edited, because yes, you can capture the scalebar, it's just tricky as Ricky showed above because of the size of the browser window. Ok, so I figured out how to move the scalebar before the image of the map is captured.
map.zoomSliderVisible = false;
map.addEventListener(FlexEvent.UPDATE_COMPLETE, onUpdateComplete_handler);
var i:uint = 0;
var x:uint = map.staticLayer.numChildren;
for (i; i < x; i++) {
trace("What is this object? {0}", map.staticLayer.getChildAt(i));
if (map.staticLayer.getChildAt(i) is ScaleBar) {
trace("found the scale bar! left =", (map.staticLayer.getChildAt(i) as ScaleBar).left);
// move it into a position that works for you
(map.staticLayer.getChildAt(i) as ScaleBar).left += 200;
}
}
function onUpdateComplete_handler(e:FlexEvent):void {
map.removeEventListener(FlexEvent.UPDATE_COMPLETE, onUpdateComplete_handler);
mapImage.source = PrintMapUtil.trimmedMap(map, mapImage.width, mapImage.height);
var j:uint = 0;
for (j; j < x; j++) {
trace("What is this object? {0}", map.staticLayer.getChildAt(j));
if (map.staticLayer.getChildAt(j) is ScaleBar) {
// move it back, 5 is the default
(map.staticLayer.getChildAt(j) as ScaleBar).left = 5;
}
}
map.zoomSliderVisible = true;
}
That's tested and works with PrintMapUtil and API2.0.
Well, that was fun, now back to work.
... View more
07-15-2010
12:14 PM
|
0
|
0
|
1387
|
|
POST
|
A quick look at the description of the Shapefile Overlay description says it uses some of this library http://code.google.com/p/vanrijkom-flashlibs/wiki/SHP and Mansour Raad's post here http://thunderheadxpler.blogspot.com/2008/12/shapefile-viewer.html The latest comments also state the file has been updated to include the DBF library needed to show attributes, so you may want to try downloading it again. Looks he compiled them into a nice .swc already. The source should be the same as here http://vanrijkom-flashlibs.googlecode.com/svn/trunk/org/vanrijkom/dbf/ If you check out the example Mansour provides, he also uses that DBF library from the same author to show the attribute data. Unforunately, I don't know of a way to read a .lyr file and parse it in Flex. I don't know enough about the internals of the file for that.
... View more
07-15-2010
05:59 AM
|
0
|
0
|
1295
|
|
POST
|
Try adding the objects to map.staticLayer map.staticLayer.addElement(component) I show an example here adding lat/long coordinates http://odoe.net/blog/?p=67 The docs for Map state, "StaticLayer is useful for adding legends, logos and other items that should not be moved when the map is panned or zoomed." That should work.
... View more
07-15-2010
05:42 AM
|
0
|
0
|
305
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 2 | 11-06-2025 11:10 AM | |
| 3 | 11-05-2025 02:54 PM | |
| 1 | 11-04-2025 02:38 PM | |
| 1 | 10-27-2025 08:17 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|