|
POST
|
Hi Rahul, Say I have 10,000 features to loop through until I find the right one - I'd assume that running a query by ObjectID would be a lot faster than having to process all of those features, and evaluate each one to check whether it has the right OID. Thanks, Steve
... View more
02-19-2013
01:42 PM
|
0
|
0
|
1351
|
|
POST
|
It's possible to create a featureLayer on-the-fly using a featureCollection, as described at http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#FeatureLayer/FeatureLayerConst2, which also mentions: The feature layer generates a unique object id for new features. Does not support queries that need to be performed on the server, e.g. queries with a where clause Does this mean that a featureLayer based on a featureCollection will not support featureLayer.queryFeatures based on query.objectIds as in this example? var query = new esri.tasks.Query(); query.objectIds = [features[0].attributes.OBJECTID]; query.outFields = [ "*" ]; // Query for the features with the given object ID featureLayer.queryFeatures(query, function(featureSet) { }); I'm seeing sporadic results, with the query sometimes working and sometimes not working. Unfortunately I don't have an easily reproducible piece of code that I can share. Thanks for any advice, Steve
... View more
02-17-2013
03:19 PM
|
0
|
4
|
1878
|
|
POST
|
you are suggesting I basically create a bubble (the buffer) around a point clicked and then query for any graphics within that space. This is necessary when selecting a point, since it's virtually impossible for you to click exactly on the point's location. Instead, you want to select any point within a certain distance of the mouse coordinates. This distance can be very small, eg 3 pixels. Note that even in ArcMap, that's what happens when you use the Select tool. This seems even less precise then allowing the user to draw a box around the object, as then not only do they have to click within a certain distance of the center point of the point, but they will be more likely to select and delete other nearby graphics. You could use logic such as: - if only one point is returned, delete it - if multiple features are returned, highlight them and let the user toggle through them to decide which one(s) to delete An example of what I want to do is this: draw a large cross symbol on the map and be able to click on any of the arms of that cross to select it but not select it if I click on the white space between arms. I have seen this done on other current GIS web applications, so I know it is possible. I just don't know how to get to the point where I am interacting with what is drawn on the screen versus its point representation in the graphics layer. You'd need to write this yourself as there's nothing out-of-the-box which will do this. The basic principle will be the same though - rather than searching for points within the circular buffer you'd be searching within the cross-shaped graphic. Good luck, Steve
... View more
02-15-2013
02:49 PM
|
0
|
0
|
1283
|
|
POST
|
Hans, If you're going to update your code you might as well go straight to the latest version (3.3), otherwise you'll end up rewriting it twice. See the Migrating to 3.x document for some pointers. Steve
... View more
02-14-2013
12:41 PM
|
0
|
0
|
1002
|
|
POST
|
when working with point features, especially text and large symbols, the user has to select the exact point Hi Jonathan, You can get around this by buffering the point clicked by the user, and using the buffer to select your graphics. There's a sample here which shows how to get started. Steve
... View more
02-14-2013
12:40 PM
|
0
|
0
|
1283
|
|
POST
|
Hi James, Are you able to share your code or link to a live example? This will make it a lot easier to debug. Prior to the 3.3 release of the JS API it wasn't possible to remove the basemap layer, but this is now possible: Use a graphics layer or a feature layer as the only layer in a map The map no longer requires a tiled or dynamic service to be the first type of layer added to the map. View the new Feature Layer in any projection sample or thegas prices by state example to see this in action. Are you using v3.3? Steve
... View more
02-14-2013
12:21 PM
|
0
|
0
|
916
|
|
POST
|
The query that I was using wasn't returning a feature within the map extent, so it was never going to work. I've updated the sample with a new extent and slightly different query, and it's working OK now.
... View more
02-12-2013
05:22 PM
|
0
|
1
|
1313
|
|
POST
|
Stepping through it, I can see that this line:
var featureSet = new esri.tasks.FeatureSet({
features: results.features
}); is stripping the geometry from the results, meaning that the feature layer has no geometry.
function selectShowResults(results) {
//Create a feature layer from the results
var graphics = [];
var sfs = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT,
new dojo.Color([255,0,0]), 2),new dojo.Color([255,255,0,0.25]));
var infoTemplate = new esri.InfoTemplate();
for (var i = 0; i < results.features.length; i++) {
var feature = results.features;
var graphic = new esri.Graphic(feature.geometry,sfs,feature.attributes,infoTemplate);
graphics.push(graphic);
}
var sr = new esri.SpatialReference(102100);
var featureSet = new esri.tasks.FeatureSet({
geometryType: "esriGeometryPolygon",
features: graphics,
spatialReference: sr
});
Still no luck, though.... Thanks for any advice.
... View more
02-12-2013
02:28 PM
|
0
|
0
|
1313
|
|
POST
|
Is anyone able to explain why the attached code isn't working? Also available live here. I'm trying to create a featureLayer from a featureCollection based on the results of a query. I'm finding that the featureLayer is apparently created, and I can see that it contains graphics (map.getLayer("query layer").graphics.length shows there are 167 features in the new layer), but they are not visible on the map. There should be a polygon shown in the centre of the map. The relevant code is: queryTask.execute(query, selectShowResults, SQLerror); function selectShowResults(results) { //Create a feature layer from the results var featureSet = new esri.tasks.FeatureSet({ features: results.features }); var fields = [ { "name": "NAME", "type": "esriFieldTypeString", "alias": "Name" }, { "name": "OBJECTID", "type": "esriFieldTypeOID", "alias": "OBJECTID" } ] var layerDefinition = { "geometryType": "esriGeometryPolygon", "fields": fields, "objectIdField": "OBJECTID", } var featureCollection = { layerDefinition: layerDefinition, featureSet: featureSet }; var layer = new esri.layers.FeatureLayer(featureCollection, { id: "query layer", mode: esri.layers.FeatureLayer.MODE_SNAPSHOT }) var renderer = new esri.renderer.SimpleRenderer( new esri.symbol.SimpleFillSymbol("solid", null, new dojo.Color([255, 0, 255, 0.75]) )); layer.setRenderer(renderer); map.addLayer(layer); } Thanks, Steve
... View more
02-12-2013
01:54 PM
|
0
|
3
|
4224
|
|
POST
|
Looking at your site, I think the method you're using works well +1, it looks great. But why duplicate things by showing both feature and dynamic layers - why not remove the dynamic layer and just use the feature?
... View more
02-06-2013
06:05 PM
|
0
|
0
|
1352
|
|
POST
|
Thanks Derek. Could you update the doco at http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#querytask to include exceededTransferLimit? Cheers, Steve
... View more
02-05-2013
07:22 PM
|
0
|
0
|
1516
|
|
POST
|
On ArcGIS Server's admin side it's possible to set the maximum number of results which will be returned by a query - by default the value is 1,000 records. Can I detect that this limit has been reached when performing a query? Eg, this query returns 1,000 records. Is it possible to detect that there are more records which were not returned, ie can I detect that I've hit a limitation? Thanks, Steve
... View more
02-05-2013
06:36 PM
|
0
|
5
|
2200
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-17-2014 08:45 PM | |
| 1 | 03-15-2011 04:23 PM | |
| 1 | 10-18-2019 12:50 AM | |
| 3 | 01-22-2019 02:33 PM | |
| 1 | 09-26-2011 10:36 PM |
| Online Status |
Offline
|
| Date Last Visited |
10-20-2022
12:19 AM
|