How to use @esri/arcgis-rest-feature-layer - 5 common examples

To help you get started, we’ve selected a few @esri/arcgis-rest-feature-layer 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 Esri / arcgis-rest-js / demos / stream-response-to-file / index.js View on Github external
const { queryFeatures } = require("@esri/arcgis-rest-feature-layer");
const fs = require("fs");
const fetch = require('node-fetch');
require('isomorphic-form-data')

const outFileName = `./output/${Date.now()}.geojson`
const outFile = fs.createWriteStream(outFileName);
const serviceUrl = "https://services.arcgis.com/uUvqNMGPm7axC2dD/arcgis/rest/services/Boating_Access_Sites/FeatureServer/0/query";

// const params = {
//   outSR: "4326",
//   returnGeometry: true,
//   f: "geojson"
// };

queryFeatures({
  url: serviceUrl,
  outSR: "4326",
  returnGeometry: true,
  f: "geojson",
  rawResponse: true,
  fetch: fetch
}).then((resp) => {
  //Access any response methods, or ReadableStream body
  //https://developer.mozilla.org/en-US/docs/Web/API/Response
  const stream = resp.body
  stream.pipe(outFile);
  stream.on('data', (data) => {
    console.log("Buffering: ", data)
  });
  stream.on('end', () => {
    console.log(`Finished: ${outFileName}`);
github vannizhang / wayback / src / core / WaybackManager / Metadata.ts View on Github external
params: IParamsQueryMetadata
    ): Promise {
        const fields = config['metadata-layer'].fields;

        const FIELD_NAME_SRC_DATE = fields[0].fieldname;
        const FIELD_NAME_SRC_PROVIDER = fields[1].fieldname;
        const FIELD_NAME_SRC_NAME = fields[2].fieldname;
        const FIELD_NAME_SRC_RES = fields[3].fieldname;
        const FIELD_NAME_SRC_ACC = fields[4].fieldname;

        const queryUrl = this.getQueryUrl(params.releaseNum, params.zoom);

        const outFields = fields.map((d) => d.fieldname);

        try {
            const queryResponse = (await queryFeatures({
                url: queryUrl,
                geometry: params.pointGeometry,
                geometryType: 'esriGeometryPoint',
                spatialRel: 'esriSpatialRelIntersects',
                outFields,
                returnGeometry: false,
                f: 'json',
            })) as IQueryFeaturesResponse;

            const feature: IFeature =
                queryResponse.features && queryResponse.features.length
                    ? queryResponse.features[0]
                    : null;

            const date = feature.attributes[FIELD_NAME_SRC_DATE];
            const provider = feature.attributes[FIELD_NAME_SRC_PROVIDER];
github Esri / solution.js / packages / simple-types / src / workforce.ts View on Github external
return new Promise((resolve, reject) => {
    if (dispatchers && dispatchers.url) {
      queryFeatures({
        url: dispatchers.url,
        where: "userId = '" + name + "'",
        authentication: destinationAuthentication
      }).then(
        (results: any) => {
          if (results && results.features) {
            if (results.features.length === 0) {
              addFeatures({
                url: dispatchers.url,
                features: [
                  {
                    attributes: {
                      name: fullName,
                      userId: name
                    }
                  }
github vannizhang / wayback / src / core / WaybackManager / ChangeDetector.ts View on Github external
async getRNumsFromDetectionLayer(
        pointInfo: IMapPointInfo,
        zoomLevel: number
    ): Promise> {
        const queryUrl = this.changeDetectionLayerUrl + '/query';

        const fields = config['change-detection-layer'].fields;

        const FIELD_NAME_ZOOM = fields[0].fieldname;
        const FIELD_NAME_RELEASE_NUM = fields[1].fieldname;
        const FIELD_NAME_RELEASE_NAME = fields[2].fieldname;

        try {
            const queryResponse = (await queryFeatures({
                url: queryUrl,
                geometry: pointInfo.geometry,
                geometryType: 'esriGeometryPoint',
                spatialRel: 'esriSpatialRelIntersects',
                where: `${FIELD_NAME_ZOOM} = ${zoomLevel}`,
                outFields: [FIELD_NAME_RELEASE_NUM],
                orderByFields: FIELD_NAME_RELEASE_NAME,
                returnGeometry: false,
                f: 'json',
            })) as IQueryFeaturesResponse;

            const rNums: Array =
                queryResponse.features && queryResponse.features.length
                    ? queryResponse.features.map((feature: IFeature) => {
                          return feature.attributes[FIELD_NAME_RELEASE_NUM];
                      })
github Esri / solution.js / packages / simple-types / src / workforce.ts View on Github external
(results: any) => {
          if (results && results.features) {
            if (results.features.length === 0) {
              addFeatures({
                url: dispatchers.url,
                features: [
                  {
                    attributes: {
                      name: fullName,
                      userId: name
                    }
                  }
                ],
                authentication: destinationAuthentication
              }).then(
                addResults => {
                  if (addResults && addResults.addResults) {
                    resolve(true);
                  } else {
                    reject(

@esri/arcgis-rest-feature-layer

Feature layer query and edit helpers for @esri/arcgis-rest-js

Apache-2.0
Latest version published 1 year ago

Package Health Score

73 / 100
Full package analysis