validate point geometery with location

776
2
Jump to solution
02-01-2019 09:50 AM
MRReddy
Occasional Contributor

Hi

in my case i have some graphic points and i'm looking for filtering points based on geometry

for example

assigning color to graphic points

if point is inside los angeles then green color

else red color

no idea how to validate point geometry with area

Any suggestions?

Thanks

0 Kudos
1 Solution

Accepted Solutions
HezronPhilip
New Contributor II

Hi,

Depends on how you are loading the points, you can check point within polygon using the following method;

Polygon | API Reference | ArcGIS API for JavaScript 3.27 

let boolean = PolygonFeature.contains(PointFeature); //This returns a boolean that will let you know if the point lies within a polygon.

you can use this to set attributes to the point feature and then use Unique Value Renderer, or you can run a loop to check condition and then change the color of the point using setColor or setSymbol methods.

View solution in original post

0 Kudos
2 Replies
HezronPhilip
New Contributor II

Hi,

Depends on how you are loading the points, you can check point within polygon using the following method;

Polygon | API Reference | ArcGIS API for JavaScript 3.27 

let boolean = PolygonFeature.contains(PointFeature); //This returns a boolean that will let you know if the point lies within a polygon.

you can use this to set attributes to the point feature and then use Unique Value Renderer, or you can run a loop to check condition and then change the color of the point using setColor or setSymbol methods.

0 Kudos
MRReddy
Occasional Contributor

I tried  with

 var polygon = new Polygon(new SpatialReference({ wkid: 4326 }));
                  polygon.addRing([[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]]);
                  let boolean = polygon.contains(amspoint);

how to create a ring of my selected method or else can I pass layer directly

0 Kudos