← All procedures

geo.arcgisFeatures

Give the features of an ArcGIS layer in a box as GeoJSON, for example the evacuation zones of an official map service

CLI
Package
@procedures/geo · README
Path
["geo","arcgisFeatures"]
CLI
mark geo arcgisFeatures --layerUrl <string> --bbox <object> --userAgent <string>
As data
{"$proc":["geo","arcgisFeatures"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/geo/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["geo","arcgisFeatures"], { layerUrl: "<layerUrl>", bbox: {}, userAgent: "<userAgent>" });
console.log(JSON.stringify(result));

From the command line

$ mark geo arcgisFeatures --layerUrl <string> --bbox <object> --userAgent <string>

As data, in a program

{
  "$proc": ["geo", "arcgisFeatures"],
  "input": {
    "layerUrl": "<layerUrl>",
    "bbox": {},
    "userAgent": "<userAgent>"
  }
}

Input

FieldTypeRequiredDefaultDescription
layerUrlstringyesThe URL of the layer, for example https://host/arcgis/rest/services/Name/FeatureServer/0
bboxobjectyesThe box (degrees). When west is more than east, the box crosses the antimeridian
wherestringnoThe SQL condition of the query (default: 1=1, each feature)
outFieldsstring[]noThe fields of each feature (default: each field)
returnGeometrybooleannoFalse for features with no geometry, a smaller answer (default: true)
maxAllowableOffsetnumbernoThe largest distance in degrees between a geometry and its simplified form (default: no simplification)
userAgentstringyesThe User-Agent that names your application and a contact. The policies of the public servers require it
pageSizeintegernoThe largest number of features of one request (default: 1000)
maxFeaturesintegernoThe largest number of features of the output (default: 10000)
timeoutMsintegernoThe time limit of one request, in milliseconds (default: 30000)

Output

FieldTypeRequiredDefaultDescription
collectionobjectyesThe features as a GeoJSON feature collection (RFC 7946)
requestsintegeryesThe number of requests to the layer
truncatedbooleanyesTrue when the layer has more features than maxFeatures, or when it stopped the pages
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "layerUrl": {
        "type": "string",
        "format": "uri",
        "description": "The URL of the layer, for example https://host/arcgis/rest/services/Name/FeatureServer/0"
      },
      "bbox": {
        "type": "object",
        "properties": {
          "west": {
            "type": "number",
            "minimum": -180,
            "maximum": 180
          },
          "south": {
            "type": "number",
            "minimum": -90,
            "maximum": 90
          },
          "east": {
            "type": "number",
            "minimum": -180,
            "maximum": 180
          },
          "north": {
            "type": "number",
            "minimum": -90,
            "maximum": 90
          }
        },
        "required": [
          "west",
          "south",
          "east",
          "north"
        ],
        "description": "The box (degrees). When west is more than east, the box crosses the antimeridian"
      },
      "where": {
        "description": "The SQL condition of the query (default: 1=1, each feature)",
        "type": "string",
        "minLength": 1,
        "maxLength": 2000,
        "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
      },
      "outFields": {
        "description": "The fields of each feature (default: each field)",
        "maxItems": 100,
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "pattern": "^[A-Za-z0-9_.]+$"
        }
      },
      "returnGeometry": {
        "description": "False for features with no geometry, a smaller answer (default: true)",
        "type": "boolean"
      },
      "maxAllowableOffset": {
        "description": "The largest distance in degrees between a geometry and its simplified form (default: no simplification)",
        "type": "number",
        "exclusiveMinimum": 0,
        "maximum": 1
      },
      "userAgent": {
        "type": "string",
        "minLength": 3,
        "maxLength": 300,
        "pattern": "^[\\x20-\\x7e]+$",
        "description": "The User-Agent that names your application and a contact. The policies of the public servers require it"
      },
      "pageSize": {
        "description": "The largest number of features of one request (default: 1000)",
        "type": "integer",
        "minimum": 1,
        "maximum": 2000
      },
      "maxFeatures": {
        "description": "The largest number of features of the output (default: 10000)",
        "type": "integer",
        "minimum": 1,
        "maximum": 100000
      },
      "timeoutMs": {
        "description": "The time limit of one request, in milliseconds (default: 30000)",
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 120000
      }
    },
    "required": [
      "layerUrl",
      "bbox",
      "userAgent"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "collection": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "FeatureCollection"
          },
          "features": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "Feature"
                },
                "id": {
                  "type": [
                    "string",
                    "number"
                  ]
                },
                "geometry": {
                  "description": "A GeoJSON geometry, or null"
                },
                "properties": {
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "type",
                "geometry",
                "properties"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "type",
          "features"
        ],
        "additionalProperties": false,
        "description": "The features as a GeoJSON feature collection (RFC 7946)"
      },
      "requests": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991,
        "description": "The number of requests to the layer"
      },
      "truncated": {
        "type": "boolean",
        "description": "True when the layer has more features than maxFeatures, or when it stopped the pages"
      }
    },
    "required": [
      "collection",
      "requests",
      "truncated"
    ],
    "additionalProperties": false
  }
}