I have a feature layer of points and a tiledLayer of roads and municipality polygons. I want to query the points against the municipality polygons and return the ID's of the points within a specified municipality.
I already have a function that zooms to a municipality:
var zoomToMuni = function zoomToMuni(selectedMuni) {
// where clause
var whereClause = "MUNI = '".concat(selectedMuni, "'");
var query = L.esri.query({
url: 'https://services1.arcgis.com/MuniBoundariesService'
});
query.where(whereClause).bounds(function (error, latLngBounds, response) {
if (error) {
// add message to console
console.warn('An error with the query request has occured');
console.warn("Code: ".concat(error.code, "; Message: ").concat(error.message)); // set content of results element
} else if (response.features < 1) {
// add message to console
console.log('No features selected'); // set content of results element
} else {
map.fitBounds(latLngBounds);
}
});
Ideally I would query the points in a way like "Points WITHIN SELECTEDMUNI", and then get the ID's returned by this and set a whereClause on the points that include these ID's.
I'm not sure this is possible with the examples I am seeing or the fact that the municipality polygons are a tiledLayer.