I am wanting to do a point filter for a polygon. But when passing the geometry, the points do not filter. Allen Thompson
Are the points and the polygon in the same spatial reference?
If they are in the same coordinate system. But when I pass the parameter of the polygon geometry. I get an error.
I don't see in your code what distrito.event object is.
areaspriorizadas is type point
distrito is type polygon
Filtering points within a polygon is required
The issue is that if
geometry: distrito.event.geometry
was a single polygon with the same spatial reference as areaspriorizadas then there would not be any issue.
So are you sure that distrito.event.geometry is not null and is a single polygon geometry?
What happens is that I want to filter the points (areaspriorizadas) within a polygon (distrito). At the time of passing the extension to consider. It does not filter the contained points. I have seen that if I put (geometry: view.extent) it filters the extension of the map. But I don't know how to filter the points inside the polygon (distrito)
As I mentioned before you can only filter the view on a Single geometry. So you would have to get a single feature from the distro featurelayer and grab the one features geometry to use in the filter.
mapView.whenLayerView(areaspriorizadas).then(function(featureLayerView) {
var polyFeat, query;
query = distrito.createQuery();
query.outSpatialReference = view.spatialReference;
query.returnGeometry = true;
distrito.queryFeatures(query).then(function(results){
polyFeat = results.features[0].geometry;
});
featureLayerView.filter = {
geometry: polyFeat,
patialRelationship: "contains"
};
});
I have tried the code, but it still does not filter the points by polygon. Maybe there is something I am not considering.
I made some adjustments and it worked perfectly. Thank you very much for your support