Spatial relationship touches

1198
4
06-14-2011 09:41 PM
DemyanovaElena
New Contributor
Hi! Glad to use this forum! I have a question for experts.
How can I use JScript API ArcGIS Server to get polygons ID that touch to the selected polygon?
Thanks a lot for your time!
0 Kudos
4 Replies
HemingZhu
Occasional Contributor III
Hi! Glad to use this forum! I have a question for experts.
How can I use JScript API ArcGIS Server to get polygons ID that touch to the selected polygon?
Thanks a lot for your time!


Not sure exactly what your situation is , there are a couple of ways to achieve your goal throught JS API. GeometryService.relation(relationParameters, callback?, errback?) computes the two sets of geometries that belong to the specified relation, you could specify the relationParams.relation constant to the relationship you would like to compute (SPATIAL_REL_LINETOUCH or specify SPATIAL_REL_RELATION); Or you could do a QueryTask using a spatial filter (esri.tasks.Query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_TOUCHES or specify SPATIAL_REL_RELATION), it find out the feature(s) from one layer (or graphic(s)) touches the border of feature(s) from another layer.
0 Kudos
derekswingley1
Frequent Contributor
The Query for polygon and adjacent polygons sample sounds like it fits your needs. Note the part about the proxy, that trips up a quite a few people.
0 Kudos
nicogis
MVP Frequent Contributor
Extra info:
if you need custom spatial relationship you can use scl in api esri:
http://nicogis.blogspot.com/2011/02/scl-da-client.html

In your case:

The size of the intersection of G1 and G2 is not nothing.
The size of the intersection and G1.interior G2.interior is nothing

TOUCH G1 G2 is then equivalent to saying that dim (g1.interior, g2.interior) = null and dim (g1, g2)! = Null


All the following examples are equivalent (because the SCL syntax to inherit and CBM):

G1 TOUCH G2
G1 TOUCHES G2
G1 =* G2
TOUCH (G1,G2) = TRUE
TOUCHES (G1,G2) = TRUE

for use scl in  http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/relationparameters.htm
use SPATIAL_REL_RELATION
0 Kudos
DemyanovaElena
New Contributor
The Query for polygon and adjacent polygons sample sounds like it fits your needs. Note the part about the proxy, that trips up a quite a few people.


Oh, thanks! This is what I need.
I was so inattentive that didn't see this example! Try to correct! 🙂
0 Kudos