check if point exist in geometry query feature layer

269
3
Jump to solution
05-31-2022 11:47 PM
SriharshaK
New Contributor II

Hello guys! I am trying to plot polygon layers on existing feature layer. Before that I need to get if points exist in a particular geometry after querying the feature layer. Can I also show different color for rings of polygon?

Here is my code below.

 

            const queryNew = myFeatureLayer.createQuery();
            queryNew.spatialRelationship = "intersects";
            queryNew.returnGeometry = true;
            myFeatureLayer.queryFeatures(queryNew).then(function (results) {
              const result = results.features.map((data) => data.geometry["rings"][0]);
              
              const poly = new Polygon({
                spatialReference: {
                  wkid: 4283
                },
              });

              slider.on("thumb-drag", function (event) {

                const filterForecast = forecast.filter(
                  (data) =>
                    data.poaching_risk * 100 > slider.values[0] &&
                    data.poaching_risk * 100 < slider.values[1]
                );

                var riskLatlonFilter = (filterForecast as unknown as any[]).map(
                  (element) => {
                    return [element.lon, element.lat];
                  }
                );

                console.log(riskLatlonFilter);
              });
            });

 

 

0 Kudos
1 Solution

Accepted Solutions
BlakeTerhune
MVP Regular Contributor

It doesn't look like you've set the geometry property of your "queryNew" query object. Set that to be the geometry of the polygon(s) you want to intersect the features in "myFeatureLayer".

View solution in original post

3 Replies
BlakeTerhune
MVP Regular Contributor

It doesn't look like you've set the geometry property of your "queryNew" query object. Set that to be the geometry of the polygon(s) you want to intersect the features in "myFeatureLayer".

SriharshaK
New Contributor II

Can I change colour for different polygon.

0 Kudos
BlakeTerhune
MVP Regular Contributor

That's a vague question, but generally, Yes. Check out Data-driven styles. Here's a tutorial.

If you want to style based on something else, you could look into making a Graphics Layer and applying the symbology however you want.

0 Kudos