How to use the esri-leaflet.query function in esri-leaflet

To help you get started, we’ve selected a few esri-leaflet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CityOfPhiladelphia / mapboard / src / controller / data-manager.js View on Github external
getParcelsByLatLng(latlng, parcelLayer, fetch) {
    // console.log('171111 getParcelsByLatLng', parcelLayer, 'fetch', fetch);

    const url = this.config.map.featureLayers[parcelLayer+'Parcels'].url;
    const parcelQuery = Query({ url });
    parcelQuery.contains(latlng);
    const test = 5;
    parcelQuery.run((function(error, featureCollection, response) {
        // console.log('171111 getParcelsByLatLng parcelQuery ran', test, 'fetch', fetch, 'response', response);
        this.didGetParcels(error, featureCollection, response, parcelLayer, fetch);
      }).bind(this)
    )
  }
github CityOfPhiladelphia / mapboard / src / controller / data-manager.js View on Github external
getParcelsById(id, parcelLayer) {
    // console.log('getParcelsById', parcelLayer);

    const url = this.config.map.featureLayers[parcelLayer+'Parcels'].url;
    const configForParcelLayer = this.config.parcels[parcelLayer];
    const geocodeField = configForParcelLayer.geocodeField;
    const parcelQuery = Query({ url });
    parcelQuery.where(geocodeField + " = '" + id + "'");
    // console.log('parcelQuery:', parcelQuery);
    parcelQuery.run((function(error, featureCollection, response) {
      // console.log('171111 getParcelsById parcelQuery ran, response:', response);
      this.didGetParcels(error, featureCollection, response, parcelLayer);
    }).bind(this)
  )
  }
github CityOfPhiladelphia / mapboard / src / controller / clients / esri-client.js View on Github external
fetchBySpatialQuery(dataSourceKey, url, relationship, targetGeom, parameters = {}, options = {}, calculateDistancePt) {
    console.log('fetch esri spatial query, dataSourceKey:', dataSourceKey, 'url:', url, 'relationship:', relationship, 'targetGeom:', targetGeom, 'parameters:', parameters, 'options:', options);

    let query;
    if (relationship === 'where') {
      query = Query({ url })[relationship](parameters.targetField + "='" + parameters.sourceValue + "'");
    } else {
      query = Query({ url })[relationship](targetGeom);
    }

    // apply options by chaining esri leaflet option methods
    const optionsKeys = Object.keys(options) || [];
    query = optionsKeys.reduce((acc, optionsKey) => {
      const optionsVal = options[optionsKey];
      let optionsMethod;

      try {
        acc = acc[optionsKey](optionsVal);
      } catch (e) {
        throw new Error(`esri-leaflet query task does not support option:
                         ${optionsKey}`);
      }

      return acc;