Select to view content in your preferred language

validate point geometery with location

973
2
Jump to solution
02-01-2019 09:50 AM
MRReddy
Regular 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
Occasional Contributor

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
Occasional Contributor

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
Regular 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