Select to view content in your preferred language

I need an example of how to use a spatial relationship in a query.

2530
12
06-22-2010 02:06 PM
TracySchloss
Honored Contributor
I've seen posts where the goal is to let the user draw a polygon and select features within it.  However, I have a twist  on that.  I have a find task that will select a particular district number.  This is displayed to the user in a graphicslayer as a single polygon (will only ever have one polygon in it,  it's just a highlight and I continually clear it out).  I would then like to select all the points in another layer that fall within that district

I see that I can define my query to have a spatialRelationship of "SPATIAL_REL_WITHIN", but I can't find a good example of how I might use this.  I"m not even sure this is my best approach.  I've also been looking at the geometry service and the relations it returns.
Tags (2)
0 Kudos
12 Replies
RobertScheitlin__GISP
MVP Emeritus
Tanya,

   When you use the QueryTask there is a "text" and a "where" attribute on the Query.
The text property will search the display field of your layer, it is a short hand for a where clause of:  where YourDisplayField like '%SearchText%'.

You want to use the where attribute so you can have a specific SQL query statement.
0 Kudos
tanyabisen
Emerging Contributor
Ok will try that again... I hope you went through the website link and could see the random behaviour for certain division numbers.. Thanks..will keep u posted if once it gets resolved..
0 Kudos
tanyabisen
Emerging Contributor
Hey Robert, it worked with where clause..Guess some logic issue in Find Task but Query task works fine now..

Thanks a ton...

Regards,
Tanya
0 Kudos