Select to view content in your preferred language

Spatial Query Tool - Urgent

854
3
11-22-2013 06:26 PM
EdwardSohn1
Emerging Contributor
Is there a spatial query tool for Javascript avaiable somewhere?
Like there is for Silverlight?
Or Sample code snippet, etc.?

What I need is Javascript based query tool that allows user to draw:
rectangle
free polygon
freehand
circle/ellipse

and then search the feature layer based on these shapes.
0 Kudos
3 Replies
JasonZou
Frequent Contributor
There is no existing spatial query tool provided by JS API. You can use the draw toolbar to draw a graphic. Then use it to perform spatial query using either QueryTask or featureLayer.queryFeatures.

Here are two samples you can refer to:
Draw toolbar: http://developers.arcgis.com/en/javascript/samples/toolbar_draw/
Spatial Query sample: https://developers.arcgis.com/en/javascript/jssamples/fl_selectfeatures.html
0 Kudos
EdwardSohn1
Emerging Contributor
There is no existing spatial query tool provided by JS API. You can use the draw toolbar to draw a graphic. Then use it to perform spatial query using either QueryTask or featureLayer.queryFeatures.

Here are two samples you can refer to:
Draw toolbar: http://developers.arcgis.com/en/javascript/samples/toolbar_draw/
Spatial Query sample: https://developers.arcgis.com/en/javascript/jssamples/fl_selectfeatures.html


Hi, would you happen to have the source for a query tool that combines the above two samples?
I.e. sample code that draws rectangle, ellipse, polygon, freehand polygon, circle, and at the end of the drawing, clear the current features and query the feature layer to return the features within the geometry?

It would be nice if the digit buttons are inside some sort of dropdown content control that drops from a spatial query tool icon, and each have some sort of icons associated with it.

Sorry, just urgent is why.  Why doesn't JavaScript API have better widgets library and sample codes like Silverlight...?

At any rate, I am working on decoding the sample codes above and merging them and creating the appropriate tool icons in the meanwhile and doing basically what I am asking (and I am sure I can get it done if I don't hear from you).  But thank you for pointing me!
0 Kudos
JeffPace
MVP Alum
Sorry but if you want code that combines the two together you (or someone else) will have to write it (it doesnt already exist)

The Javascript API sacrifices the the flashy drag and droppy style of silverlight/flex for more power and more customization.

In the end, the product is better, but it takes more work from the developer.
0 Kudos