Select to view content in your preferred language

Select line features onClick

719
4
07-01-2010 09:06 AM
davidrenz
Deactivated User
I need to select a line feature and get the ID returned, along with "selecting" that line.
I know how to do that with the ADF, but don't know how to do that with JSAPI.

Also, I need to be able to add multiple line segments to the selectionset.

My thinking here is that i could do this with a Buffer or GP task, but am not sure which way to go about this. The query task popped up, and that looked good too.

Is this a queryTask?
If so, got any examples?

I am currently using a query task with :
query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;

to get the x/y of the click, but am not sure how to select the line.

Could anyone point me in the correct direction?

thanks!
david
0 Kudos
4 Replies
AlessioDi_Lorenzo
Emerging Contributor
You can do a "fake selection" with the query task.
Draw a geometry to create a bounding box (build a drag selection tool or use a polygon) and use it as value of query.geometry.
The query task result will highlight (fake select) the line and return the attributes that you can use as you want.
Obviously the query task result is "only" a FeatureSet... but it can do the job.
0 Kudos
derekswingley1
Deactivated User
If you're using 2.0, Feature Layers support selections:  http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/fl_selectfeatures.html
0 Kudos
davidrenz
Deactivated User
thanks fellers!
am going with the 2.0 stuff!
i kind of hacked it together with identify using the old api stuff, this 2.0 stuff is very cool.
0 Kudos
AlessioDi_Lorenzo
Emerging Contributor
If you're using 2.0, Feature Layers support selections:  http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/fl_selectfeatures.html


very cool 🙂
0 Kudos