Select to view content in your preferred language

Highlight points within polygon using query task

1089
7
08-29-2011 04:05 AM
tanyabisen
Emerging Contributor
Hi All,

I am trying to use query task and I am querying on a polygon layer. Is it possible to highlight points withing that polygon using query task ?? If not then what is the alternative way to achieve that.

I want it on similar lines the way it is shown in the link below

http://localgovtemplates2.esri.com/ElectionPollingPlace/default.htm

Thanks,
Tanya
Tags (2)
0 Kudos
7 Replies
Atma_BharathiMani
Deactivated User
Hi Tanya,
Although not a direct solution, the arcpy.SelectLayerByLocation_management() function comes close to your requirement. You might perhaps use the 'WITHIN' option for this function.

You can find the help pages for the function here

Atma
0 Kudos
YungKaiChin
Regular Contributor
Yes it is possible.

When you query, you can simply assign geometry of the polygon to the geometry of the query.

The code should look something like:

whateverQuery.geometry = polygon.geometry;
whateveryQueryTask.execute(whateverQuery);
0 Kudos
tanyabisen
Emerging Contributor
Hello ykchin,

Can you please send me some sample then may be I will have better idea. Its been few months I have started working on Flex,still trying to understand the concepts.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Tanya,

   Here is the link to a sample that uses a drawn polygon to select underlying parcels:

http://help.arcgis.com/en/webapi/flex/samples/01nq/01nq0000002t000000.htm
0 Kudos
tanyabisen
Emerging Contributor
Robert,

I tried the sample which you had mentioned but it doesn't serve my requirement much. I am not allowing the user to draw the polygon.. The link which I have mentioned in my earlier post if you can see that and tell me the logic behind it then it would be great.

That link is done in Flex Viewer though. I am posting the link again

http://localgovtemplates2.esri.com/ElectionPollingPlace/default.htm

Thanks again
Regards,
Tanya
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Tanya,

   The sample link I provided give the lines of code that would be needed to select features based on a geometry. There is probably not a sample that is going to specifically meet your needs. You will have to take portions of code from multiple sources and add to it to get what you want. Maybe you need to be more specific with want is the exact portion of the link you provided that you are desiring to reproduce. You need to understand that we can not always provide you with a complete code sample for all your needs though.
0 Kudos
tanyabisen
Emerging Contributor
Oh yes that's true Robert..I completely agree..I will give another try to the sample which you have provided.. Regrading the link which i have provided, when the user searches the address it highlights a polygon and nearby polling booth with red circle along with the directions. I am not interested in getting the directions just the highlighting of polygon and the point.
0 Kudos