|
POST
|
I had the odd issues when I started working with FeatureLayer. Try listening on the rollOver/rollOut events instead, see if that helps. http://forums.arcgis.com/threads/8747-Odd-behavior-of-FeatureLayer-and-MapPoint-graphics
... View more
12-07-2010
12:56 PM
|
0
|
0
|
661
|
|
POST
|
Flex can't access local resources in that manner and although AIR can access some local resources, as far as I know com/serial ports is not one of them. You may be able to write a small app in say Java that can write to the SQLlite db that AIR can read instead of having to send a query off to a server. If this is a web app, you're method should work.
... View more
11-24-2010
01:29 PM
|
0
|
0
|
719
|
|
POST
|
My java experience is pretty limited to just database access and queries. To access SQL Server, you'll need the sqljdbc4.jar from Microsoft. One thing I am doing in that query is turning my results into a custom object I call FlowControl, which is a pretty simple Java object, but what it allows me to do is quickly serialize those objects in Flex by adding this metadata tag to a class [RemoteClass(alias="SewerDb.dto.FlowControl")] public class FlowControl... So your Flex object matches your Java object. There are lots of materials on Adobe's website and elsewhere on using BlazeDS with Flex. http://www.adobe.com/devnet/livecycle/articles/blazeds_spring.html One book that I really like that just recently went into print is Flex On Java, which covers the subject really well. If however, you are like me and prefer working in a .NET environment, you can use WebOrb for .NET, which is a great solution for tasks like this. A great benefit of WebOrb is the WebOrb console which will let you test your functions as well provide you the Actionscript code you would need to use the functions. It has fantastic code generation tools that you can use to learn from. Using RemoteObjects requires slightly more setup initially to access backend data, but it absolutely worth it in the end. We have one function to perform flow tracing that can return a few thousand records that is done via a WebOrb AMF endpoint, and as a regular WSDL web service it took up to 2 minutes to return results and we can now show the query results in less than 10 seconds.
... View more
11-22-2010
05:49 AM
|
0
|
0
|
996
|
|
POST
|
Has anyone been able to find a work around for this. The main complaint I am getting from users is the inability to zoom in further than they can now, especially because this functionality worked in the 1.3 API. Do I need to completely remove my tiled services from the project to do this? It used to be that I could disable the map.lods, turn off tiled services and zoom in on the map as far as I wanted. Now I can't do that. Any help would be appreciated here, or how can we file this as a bug?
... View more
11-22-2010
05:25 AM
|
0
|
0
|
1439
|
|
POST
|
I have a utility function I use based on a lot what Robert Scheitlin did for his Legend tool that handles PictureMarkerSymbols as well. https://github.com/odoe/FlexMapTools/blob/master/src/net/odoe/FlexMapTools/factories/SwatchFactory.as
... View more
11-22-2010
05:21 AM
|
0
|
0
|
519
|
|
POST
|
Does the data in the tables you are querying via BlazeDS match fields in your map service? For example, what I do is use BlazeDS/WebOrb to query various tables of land use and property information, get back a list of say parcel numbers, then I perform a QueryTask on the map service of parcels using those parcel numbers. For various reasons, this data sits outside an SDE, but I can use the remote service to tie everthing together. I've gotten very comfortable working with my data in this manner and because I can customize the queries to my hearts content, I actually prefer it to Relationship queries provided by the ESRI Flex API. For example, I have a java query in BlazeDS to queries some Flow data for our sewer system. public static ArrayList<FlowControl> getFlowControlList() {
ArrayList<FlowControl> flows = new ArrayList<FlowControl>();
ResultSet resultSet;
try {
connection = ConnectionHelper.sdeConnection();
Statement stmt = connection.createStatement();
String sql = "SELECT CSDAssetID, CSDFeatureID, '' AS PipeCSDAssetID, '' AS PipeCSDFeatureID, UpstreamPipeCSDAssetID, UpstreamPipeCSDFeatureID, "
+ "DownstreamPipeCSDAssetID, DownstreamPipeCSDFeatureID, FlowControlInputDate, FlowAllowed, FlowControlPosition, Subtype "
+ "FROM sde.SSCOMPLEXFLOWCONTROLHISTORY AS cf "
+ "WHERE (FlowControlInputDate = "
+ "(SELECT MAX(FlowControlInputDate) AS Expr1 "
+ "FROM sde.SSCOMPLEXFLOWCONTROLHISTORY AS cf2 "
+ "WHERE (CSDAssetID = cf.CSDAssetID) AND (CSDFeatureID = cf.CSDFeatureID))) "
+ "UNION "
+ "SELECT CSDAssetID, CSDFeatureID, PipeCSDAssetID, PipeCSDFeatureID, '' AS UpstreamPipeCSDAssetID, '' AS UpstreamPipeCSDFeatureID, "
+ "'' AS DownstreamPipeCSDAssetID, '' AS DownstreamPipeCSDFeatureID, FlowControlInputDate, FlowAllowed, FlowControlPosition, Subtype "
+ "FROM sde.SSFLOWCONTROLHISTORY AS f "
+ "WHERE (FlowControlInputDate = "
+ "(SELECT MAX(FlowControlInputDate) AS Expr1 "
+ "FROM sde.SSFLOWCONTROLHISTORY AS f2 "
+ "WHERE (CSDAssetID = f.CSDAssetID) AND (CSDFeatureID = f.CSDFeatureID))) "
+ "ORDER BY CSDAssetID";
resultSet = stmt.executeQuery(sql);
while (resultSet.next()) {
FlowControl flow = new FlowControl();
flow.setCsdAssetId(resultSet.getString(CSD_ASSET_ID));
flow.setCsdFeatureId(resultSet.getString("CSDFeatureID"));
flow.setDownstreamPipeCsdAssetId(resultSet
.getString("DownstreamPipeCSDAssetID"));
flow.setDownstreamPipeCsdFeatureId(resultSet
.getString("DownstreamPipeCSDFeatureID"));
flow.setFlowAllowed(resultSet.getBoolean("FlowAllowed"));
flow.setFlowControlInputDate(resultSet
.getDate("FlowControlInputDate"));
flow.setFlowControlPosition(resultSet
.getString("FlowControlPosition"));
flow.setPipeCsdAssetId(resultSet.getString("PipeCSDAssetID"));
flow.setSubType(resultSet.getString("Subtype"));
flow.setUpstreamPipeCsdAssetId(resultSet
.getString("UpstreamPipeCSDAssetID"));
flow.setUpstreamPipeCsdFeatureId(resultSet
.getString("UpstreamPipeCSDFeatureID"));
flows.add(flow);
System.out.println("FlowList = " + flow.getCsdAssetId() + " : "
+ flow.getCsdFeatureId());
} // end while statement
} catch (SQLException ex) {
System.out.println(ex.getMessage());
} // end try-catch block
finally {
closeConnection();
}
return flows;
} Then in my Flex project, I can use the ArrayList as a DataProvider for a table or iterate the list to build a query that will use an existing map service in my application.
... View more
11-22-2010
05:12 AM
|
0
|
0
|
996
|
|
POST
|
Sorry, I meant to remove those comments. You just need to use the event.mapPoint as the geometry for your IdentifyParameters you send to your IdentifyTask. http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/tasks/supportClasses/IdentifyParameters.html idParams.geometry = event.mapPoint; Hope that helps.
... View more
11-12-2010
09:13 AM
|
0
|
0
|
1251
|
|
POST
|
This is probably how I would handle it. You can create one function to capture all the button clicks and let that function handle what happens. You can also make sure the Identify Task will not fire when you just want to zoom or pan.
<fx:Script>
<![CDATA[
protected static const IDENTIFY:String = "identify";
protected function activateIdentify():void {
map.addEventListener(MapMouseEvent.MAP_CLICK, onMapClicked_handler);
}
protected function onMapClicked_handler(event:MapMouseEvent):void {
var idParams:IdentifyParameters = new IdentifyParameters();
idParams.layerIds = [layerId];
idParams.tolerance = 2;
idParams.returnGeometry = true;
// grab your event.mapPoint and use it for your Identify tool
idParams.geometry = event.mapPoint;
idParams.width = _map.width;
idParams.height = _map.height;
idParams.mapExtent = _map.extent;
idParams.spatialReference = _map.spatialReference;
idParams.layerOption = "all";
var idSym:SimpleMarkerSymbol = new SimpleMarkerSymbol("x", 12, 0xFF0000);
var g:Graphic = new Graphic(event.mapPoint, idSym);
// idLayer is a graphicsLayer I use to
// just show where I clicked on the map
idLayer.clear();
idLayer.add(g);
idTask.url = "urlForIdentifyTaskToUse";
idTask.execute(idParams, new AsyncResponder(onIdentifyResults_handler, onFault, g));
}
protected function removeMapListener():void {
if (map.hasEventListener(MapMouseEvent.MAP_CLICK))
map.removeEventListener(MapMouseEvent.MAP_CLICK, onMapClicked_handler);
}
protected function navigate(type:String):void {
removeMapListener(); // you can reuse this function for each of your other button clicks
switch(type) {
case NavigationTool.ZOOM_IN:
navTool.activate(NavigationTool.ZOOM_IN);
break;
case NavigationTool.ZOOM_OUT:
navTool.activate(NavigationTool.ZOOM_OUT);
break;
case NavigationTool.PAN:
navTool.activate(NavigationTool.PAN);
break;
case IDENTIFY:
activateIdentify();
break;
}
}
]]>
</fx:Script>
<s:HGroup>
<s:Button label="Zoom In" click="navigate(NavigationTool.ZOOM_IN)"/>
<s:Button label="Zoom Out" click="navigate(NavigationTool.ZOOM_OUT)"/>
<s:Button label="Pan" click="navigate(NavigationTool.PAN)"/>
<s:Button label="Identify" click="navigate(IDENTIFY)"/>
</s:HGroup>
... View more
11-12-2010
05:42 AM
|
0
|
0
|
1251
|
|
POST
|
If I understand you right, what you'd probably want to do is add an EventListener to the Map on that button click.
// For arguments sake, let's say a user clicks the Identify button twice.
// Call your remove function before adding another listener
removeMapListener(); // you can reuse this function for each of your other button clicks
map.addEventListener(MapMouseEvent.MAP_CLICK, onMapClicked_handler);
protected function onMapClicked_handler(event:MapMouseEvent):void {
// grab your event.mapPoint and use it for your Identify tool
// you can call removeMapListener() again if you'd like
}
protected function removeMapListener():void {
if (map.hasEventListener(MapMouseEvent.MAP_CLICK))
map.removeEventListener(MapMouseEvent.MAP_CLICK, onMapClicked_handler);
} I think that makes sense, and that's similar to how I handle it for my Identify Tool.
... View more
11-10-2010
01:15 PM
|
0
|
0
|
1251
|
|
POST
|
Thanks Bjorn. Looking forward to getting some test projects done this weekend. AIR lets me work in my comfort zone, but I'm still looking forward to an Android SDK. I like to get native when I can 😉
... View more
11-03-2010
06:13 AM
|
0
|
0
|
1253
|
|
POST
|
Ok, this was a weird problem. If I add the GraphicsLayer to the map right after initializing it at the same time as I dynamically add my service layers, the graphics are backwards. So services is an array map service layers
for each (var layer:Layer in services) {
map.addLayer(layer);
}
map.addLayer(parcelLayer);
But if I wait until the after I do the first query and add it, it works ok. I just add this "if" statement in my Query Result handler
if (!map.getLayer(parcelLayer.id)) {
map.addLayer(parcelLayer);
}
I don't know if it has to do with adding the GraphicsLayer before the map has been added to the stage or what exactly, but I'm going to enjoy the solution I found.
... View more
10-21-2010
09:59 AM
|
0
|
0
|
679
|
|
POST
|
I am having an odd problem this morning with graphics. I have a query that I use to query a layer, then populate the results to a GraphicsLayer. Problem is, the graphics seem to be coming back in mirrored form from the actual data. I have attached an image. The green shaded area is the service and the dark shaded area is the same polygon after it has been queried and displayed. Weird huh? Unfortunately the service is not available to the public, but here is the REST data for it.
{
"id" : 1,
"name" : "Landbase.SDE.LA_Parcels",
"type" : "Feature Layer",
"description" : "",
"definitionExpression" : "",
"geometryType" : "esriGeometryPolygon",
"copyrightText" : "",
"parentLayer" : null,
"subLayers" : [],
"minScale" : 10000,
"maxScale" : 0,
"defaultVisibility" : true,
"extent" : {
"xmin" : -13241845.3287006,
"ymin" : 3867765.81297817,
"xmax" : -13096080.9165718,
"ymax" : 4139925.57253608,
"spatialReference" : {
"wkid" : 102113
}
},
Here is the query.
public function findParcelFeatures(ains:Array):AsyncToken {
var query:Query = new Query();
query.outFields = ['*'];
query.returnGeometry = true;
query.where = queryStringFromArray(ains, "AIN");
trace(query.where);
return parcelFeaturesTask.execute(query);
function queryStringFromArray(items:Array, fieldName:String):String {
var where:String = fieldName;
for each (var item:String in items) {
if (item != "")
where += " = " + item + " OR " + fieldName;
}
var fieldL:int = fieldName.length;
var trim:int = (where.length - fieldL) - 4;
return where.substr(0, trim);
}
}
private function onParcelFeaturesLoaded_handler(fSet:FeatureSet):void {
trace("got parcel features results", fSet.features.length);
parcelLayer.clear();
//parcelLayer.graphicProvider = fSet.features;
for each (var g:Graphic in fSet.features) {
parcelLayer.add(g);
}
map.extent = GraphicUtil.getGraphicsExtent(fSet.features);
}
I deleted the service, created a new MXD, created a new MSD and rebuilt the service, but the results are the same? Any clues as to what can be causing this? Thanks.
... View more
10-21-2010
08:49 AM
|
0
|
2
|
1138
|
|
POST
|
I'm not too familiar with the Javascript API, so there may be a function for this built in, but you could pull the REST in JSON for any layer in a service like this http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Petroleum/KGS_OilGasFields_Kansas/MapServer/0?f=json&pretty=true Than you can iterate through the "fields" element which is an array of objects that has a "type" element that will tell you what type the field is. I find that for some needs, it's just easier for me to make REST requests to get that kind of detailed information.
... View more
10-13-2010
02:45 PM
|
0
|
0
|
2368
|
|
POST
|
Problem is you'll need to use an EventListener or use the AsyncResponder method. var qt:QueryTask = new QueryTask();
qt.addEventListener(QueryEvent.EXECUTE_COMPLETE, onExecuteComplete);
qt.execute(query);
// somewhere else in your code
private function onExecuteComplete(event:QueryEvent):void {
// stuff
} Without them, you have no way of knowing when the query is done. I'm thinking maybe you need to use the queryTask.executeLastResult somewhere else in the code outside the function, which is why you want to avoid the AsyncResponder method you posted. EventListeners work fine as well. I never did like the name 'executeLastResult', it's misleading. I'd think it should just be 'lastResult'.
... View more
10-07-2010
12:28 PM
|
0
|
0
|
939
|
|
POST
|
LayerDetails has a fields element, which I think contains a Field object. So what you could do is something like this pseudocode var ld:LayerDetails = fLayer.layerDetails;
var field:Field;
for each (field in ld.fields) {
// probably loop through graphics
var g:Graphic;
for each (g in fLayer.graphicsProvider) {
g.attributes[field.name] = "somedata"; // probably some if/else/switch to grab address info
}
} That could be a start, you'd just need to get your data to the right fields. Either way, you should be able to find Field names/aliases/types in fLayer.layerDetails.fields.
... View more
10-07-2010
06:57 AM
|
0
|
0
|
775
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 2 | 2 weeks ago | |
| 1 | 02-27-2026 06:31 AM | |
| 1 | 01-13-2026 02:15 PM | |
| 1 | 12-31-2025 09:05 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|