I have a base layer on top of which I will plot two separate feature layers, one containing polygons and the other containing points. Now I have to find the points which plot into the polygon. I tried various examples like https://developers.arcgis.com/javascript/jssamples/util_relation.html but somehow things are not getting done.

Can anyone suggest a better idea?


1 Answer 1


Instead of using a Geometry service, have you looked at doing this on the client using something like ESRI's open source library Terraformer?

The core module has a method polygonContainsPoint(<Polygon> polygon, <Coordinate> coordinate) that can be used client-side to do the comparison using GeoJSON for the inputs to the method.

The arc-gis-parser plug-in allows you to convert back and forth from ArcGIS Geometry to GeoJSON.

  • Whats wrong with solution I provided.
    – VIckyb
    Sep 5, 2014 at 6:41
  • Though I did not review your solution completely, I would not say that anything is wrong with your approach. One possibly relevant difference between the two solutions is my alternative is done completely in the browser using JavaScript and not requiring one or perhaps many queries that run on the server. Depending on the exact requirements, either solution might be appropriate.
    – tmcgee
    Sep 7, 2014 at 3:00
  • The Terrraformer uses node.js which makes things complicated, but i am giving a try at it. A quick overview of my solution is it takes all featues from feature layer 1 and compares each feature with feature layer2 by passing its geometry and spatial relationship as touches. But my solution becomes overhead if there is million of record.Please suggest.
    – VIckyb
    Sep 18, 2014 at 14:21
  • Terraformer can be used in NodeJS but it does not require NodeJS. Terraformer can run in the browser whereas NodeJS without or without Terraformer is run on the server.
    – tmcgee
    Sep 18, 2014 at 15:22
  • One important concern is your mention of "million of records". That is going to be a huge challenge if not impossible to accomplish in a web application. Doesn't matter if you were to post to a Geometry Service or use Terraformer in the browser. With a million records, you should pursue a completely server-based solution to do your analysis showing only the results in the web app. How you accomplish this depends on your requirements and environment.
    – tmcgee
    Sep 18, 2014 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.