Skip To Content
ArcGIS Developer
Dashboard

Query 3D (Feature Service/Layer)

Description

The query3D operation allows clients to query 3D object features and is based on the feature service layer query operation. The 3D object feature layer still supports layer and service level feature service query operations.

Request parameters

ParameterDetails
where

A WHERE clause for the query filter.

SQL-92 WHERE clause syntax on the fields in the layer is supported for most data sources. Some data sources have restrictions on what is supported. Hosted feature services in ArcGIS Enterprise running on a spatiotemporal data source only support a subset of SQL-92. For example, spatiotemporal-based feature services support the like operator but do not support the not like operator or field equivalency expressions such as field1 = field2. Below is a list of supported SQL-92 with spatiotemporal-based feature services:


( '<=' | '>=' | '<' | '>' | '=' | '!=' | '<>' | LIKE )
(AND | OR)
(IS | IS_NOT)
(IN | NOT_IN) ( '(' ( expr ( ',' expr )* )? ')' )
COLUMN_NAME BETWEEN LITERAL_VALUE AND LITERAL_VALUE

For information on how to format time and date information, see the Date-time queries section below.

Examples


where=POP2000 > 350000

where=CITY_NAME = 'Barrington'

objectIds

The object IDs of this layer or table to be queried.

Note:

There might be a drop in performance if the layer/table data source resides in an enterprise geodatabase and more than 1,000 objectIds are specified.

Syntax: objectIds=<objectId1>, <objectId2>

Example: objectIds=37, 462

time

The time instant or the time extent to query.

Time instant

Syntax: time=<timeInstant>

Example: time=1199145600000 (1 Jan 2008 00:00:00 GMT)

Time extent

Syntax: time=<startTime>, <endTime>

Example: time=1199145600000, 1230768000000 (1 Jan 2008 00:00:00 GMT to 1 Jan 2009 00:00:00 GMT)

A null value specified for start time or end time will represent infinity for start or end time, respectively. Example: time=null, 1230768000000

geometry

The geometry to apply as the spatial filter. The structure of the geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API. In addition to the JSON structures, you can specify the geometry of envelopes and points with a simple comma-separated syntax.

Syntax:

  • JSON structures: geometryType=<geometryType>&geometry={ geometry}
  • Envelope simple syntax: geometryType=esriGeometryEnvelope&geometry=<xmin>,<ymin>,<xmax>,<ymax>
  • Point simple syntax: geometryType=esriGeometryPoint&geometry=<x>,<y>

Examples:

  • geometryType=esriGeometryEnvelope&geometry={xmin: -104, ymin: 35.6, xmax: -94.32, ymax: 41}
  • geometryType=esriGeometryEnvelope&geometry=-104,35.6,-94.32,41
  • geometryType=esriGeometryPoint&geometry=-104,35.6

geometryType

The type of geometry specified by the geometry parameter. The geometry type can be an envelope, a point, a line, or a polygon. The default geometry type is an envelope.

Values: esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope

inSR

The spatial reference of the input geometry. The spatial reference can be specified as either a well-known ID or as a spatial reference JSON object. If the inSR is not specified, the geometry is assumed to be in the spatial reference of the layer.

spatialRel

The spatial relationship to be applied to the input geometry while performing the query. The supported spatial relationships include intersects, contains, envelope intersects, within, and so on. The default spatial relationship is intersects (esriSpatialRelIntersects).

At 10.9.1, a supportedSpatialRelationships property may be provided on the layer resource that specifies which spatial relationships are supported.

Values: esriSpatialRelIntersects | esriSpatialRelContains | esriSpatialRelCrosses | esriSpatialRelEnvelopeIntersects | esriSpatialRelIndexIntersects | esriSpatialRelOverlaps | esriSpatialRelTouches | esriSpatialRelWithin

distance

The buffer distance for the input geometries. The distance unit is specified by units. For example, if the distance is 100, the query geometry is a point, units is set to meters, and all points within 100 meters of the point are returned. The geodesic buffer is created based on the datum of the output spatial reference if it exists. If there is no output spatial reference, the input geometry spatial reference is used. Otherwise, the native layer spatial reference is used to generate the geometry buffer used in the query. This parameter only applies if supportsQueryWithDistance is true.

Syntax

distance=<distance>

Example

distance=100
units

The unit for calculating the buffer distance. If unit is not specified, the default will be esriSRUnit_Foot when querying feature services in ArcGIS Enterprise, and esriSRUnit_Meter when querying feature services in ArcGIS Online. This parameter only applies if supportsQueryWithDistance is true.

Values: esriSRUnit_Meter | esriSRUnit_StatuteMile | esriSRUnit_Foot | esriSRUnit_Kilometer | esriSRUnit_NauticalMile | esriSRUnit_USNauticalMile

relationParam

The spatial relate function that can be applied while performing the query operation. An example for this spatial relate function is "FFFTTT***". For more information on this spatial relate function, see the documentation for the spatial relate function.

Note:

This parameter is not supported in the ArcGIS Online hosted service case.

outFields

The list of fields to be included in the returned result set. This list is a comma-delimited list of field names. You can also specify the wildcard "*" as the value of this parameter. In this case, the query results include all the field values.

Example


//Standard usage
outFields=AREANAME,ST,POP2000

//Wildcard usage
outFields=*
havingClause

This option was added at 10.6.1. This option is a condition used with outStatistics that limits the query result to groups that satisfy the aggregation function used. The havingClause parameter is used with the groupBy and outStatistics parameters and allows you to filter results from outStatistics. This parameter applies only if the supportsHavingClause property of the layer is true.

Note:

The havingClause parameter takes aggregate functions such as AVG(<fieldname>). It does not support the outStatisticFieldName from the outStatistics parameter. For example, the having clause can't be set to >1000; it must be set as AVG(housing_price > 1000. You can also use statistics functions in the having clause that are not necessarily in the outStatisticsparameter. For example, the following returns the average housing price for neighborhoods with more than 1,000 homes:

outStatistics=[{"statisticType":"AVG","onStatisticField":"housing_price","outStatisticFieldName":"avgHousePrice"}], havingClause=COUNT(houses) > 1000

Values: AVG | COUNT | SUM | STDDEV | MIN | MAX | VAR

Note:

havingClause must be used with groupBy and outStatistics.

gdbVersion

The geodatabase version to query. This parameter applies only if the isDataVersioned property of the layer is true. If this is not specified, the query will apply to the published map’s version.

Syntax: gdbVersion=<version>

Example: gdbVersion=SDE.DEFAULT

historicMoment

This option works with ArcGIS Server services only. This is the historic moment to query. This parameter applies only if the layer is archiving enabled and the supportsQueryWithHistoricMoment property is set to true. This property is provided in the layer resource. If historicMoment is not specified, the query will apply to the current features.

Syntax

historicMoment=<Epoch time in milliseconds>

Example

historicMoment=1199145600000
returnDistinctValues

If true, it returns distinct values based on the fields specified in outFields. This parameter applies only if the supportsAdvancedQueries property of the layer is true. This parameter can be used with returnCountOnly to return the count of distinct values of subfields.

Note:

Make sure to set returnGeometry to false when returnDistinctValues is true. Otherwise, reliable results will not be returned.

Values: true | false

orderByFields

One or more field names on which the features/records need to be ordered. Use ASC or DESC for ascending or descending, respectively, following every field to control the ordering. orderByFields defaults to ASC (ascending order) if <ORDER> is unspecified. orderByFields is supported on only those layers/tables that indicate supportsAdvancedQueries is true.

Note:
If supportsOrderByOnlyOnLayerFields is true, only fields from the layer's fields array can be used with the orderByFields parameter. For example, the outStatisticfieldName from outStatistics can't be used if supportsOrderByOnlyOnLayerFields is true.

Syntax

orderByFields=field1 <ORDER>, field2 <ORDER>, field3 <ORDER>

Example

orderByFields=STATE_NAME ASC, RACE DESC, GENDER
groupByFieldsForStatistics

One or more field names on which the values need to be grouped for calculating the statistics. groupByFieldsForStatistics is valid only when the outStatistics parameter is used.

Syntax

groupByFieldsForStatistics=field1, field2

Example

groupByFieldsForStatistics=STATE_NAME, GENDER
outStatistics

The definitions for one or more field-based statistics to be calculated. This parameter is supported only on layers/tables that indicate supportsStatistics is true. When using outStatistics, the only other parameters that can be used are groupByFieldsForStatistics, orderByFields, time, and where. For information on how to use percentile statisticType, see the Percentile statistic type section below.

Note:

If outStatisticFieldName is empty or missing, the map server assigns a field name to the returned statistic field. A valid field name can only contain alphanumeric characters and an underscore. If the outStatisticFieldName is a reserved keyword of the underlying DBMS, the operation can fail. Try specifying an alternative outStatisticFieldName.

Syntax


[
  {
    "statisticType": "<count | sum | min | max | avg | stddev | var>",
    "onStatisticField": "Field1", 
    "outStatisticFieldName": "Out_Field_Name1"
  },
  {
    "statisticType": "<count | sum | min | max | avg | stddev | var>",
    "onStatisticField": "Field2",
    "outStatisticFieldName": "Out_Field_Name2"
  }  
]

Example


[
  {
    "statisticType": "sum",
    "onStatisticField": "GENDER",
    "outStatisticFieldName": "PopulationByGender"
  },
  {
    "statisticType": "avg",
    "onStatisticField": "INCOME",
    "outStatisticFieldName": "AverageIncome"
  }
]
formatFor3DObjects

This parameter is used to request a feature in a specific 3D format. If set to a valid format ID (see layer resource), the geometry of the feature response will be a 3D envelope of the 3D object and includes asset maps for the 3D object. Since formats are created asynchronously, check the flags field in the asset map if the format is available (conversionStatus=COMPLETED). If conversionStatus=INPROGRESS, the format is not ready yet. Request the feature again at a later point in time.

If a feature does not have the specified format, the feature will still be returned according to the query parameters (such as the where clause), but the asset mapping will be missing.

Potential values: 3D_dae | 3D_dwg | 3D_fbx | 3D_glb | 3D_gltf | 3D_ifc | 3D_obj | 3D_shapebuffer | 3D_shapebufferg | 3D_usdc | 3D_usdz

resultOffset

This option can be used for fetching query results by skipping the specified number of records and starting from the next record (that is, resultOffset + 1). The default is 0. This parameter only applies if supportsPagination is true. You can use this option to fetch records that are beyond maxRecordCount.

Example



resultOffset=100
resultRecordCount

This option can be used for fetching query results up to the resultRecordCount specified. When resultOffset is specified but this parameter is not, the map service defaults it to maxRecordCount. The maximum value for this parameter is the value of the layer's maxRecordCount property. The minimum value entered for this parameter cannot be below 1. This parameter only applies if supportsPagination is true.

Example

resultRecordCount=10
timeReferenceUnknownClient

Setting timeReferenceUnknownClient as trueindicates that the client is capable of working with data values that are not in UTC. If its not set to true, and the service layer's datesInUnknownTimeZone property is true, then an error is returned. The default is false

Its possible to define a service's time zone of date fields as unknown. Setting the time zone as unknown means that date values will be returned as-is from the database, rather than as date values in UTC. Non-hosted feature services can be set to use an unknown time zone using ArcGIS Server Manager. Setting the time zones to unknown also sets the datesInUnknownTimeZone layer property as true. Currently, hosted feature services do not support this setting. This setting does not apply to editor tracking date fields which are stored and returned in UTC even when the time zone is set to unknown.

Most clients released prior to ArcGIS Enterprise 10.9 will not be able to work with feature services that have an unknown time setting. The timeReferenceUnknownClient parameter prevents these clients from working with the service in order to avoid problems.. Setting this parameter to true indicates that the client is capable of working with unknown date values that are not in UTC.

Note:

ArcGIS Pro 2.7 or newer can work with these feature services.

Value: true | false

sqlFormat

The sqlFormat parameter can be either standard SQL-92 standard or it can use the native SQL of the underlying data store native. The default is none, which means the sqlFormat depends on the useStandardizedQuery parameter. For more information on formatting, see the SQL format section below.

Values: none | standard | native

Note:
The SQL format native is supported when useStandardizedQuery=false.
f

The response format. The default response format is html. The supportsQueryFormats layer property describes what formats are supported. Note that the default response format, html, is always supported.

Example

"supportedQueryFormats": "JSON,geoJSON,PBF"

The output format geoJSON is not supported if returnM is true. Starting at 10.8, geojson will return results that match the RFC7946 specification if no outSR is specified, or if outSR is set to 4326. Setting a different outSR value will return projected results. However, these will not match the RFC7946 specification.

Values: html | json | geojson | pbf

Example usage

The following is a sample request URL used to access the convert3D endpoint:

https://machine.domain.com/webadaptor/rest/services/City_Park_Assets/FeatureServer/0/query3D

JSON Response syntax


{
   "objectIdFieldName":<objectIdFieldName>,
   "globalIdFieldName":<globalIdFieldName>,
   "geometryType":<geometryType>,
   "spatialReference":"<spatialReferenceOfTheReturedFeatures>",
   "fields":[
      {
         "name":"field1",
         "type":"fieldType1",
         "alias":"alias1"
      },
      {
         "name":"field2",
         "type":"fieldType2",
         "alias":"alias2"
      }
   ],
   "assetMapFields":[
      {
         "name":"field1",
         "type":"fieldType1",
         "alias":"alias1"
      },
      {
         "name":"field2",
         "type":"fieldType2",
         "alias":"alias2"
      }
   ],
   "features":[
      <feature1>,
      <feature2>
   ]
			"assetMaps":[
      <assetMapping1>,
      <assetMapping2>,
      <assetMapping3>
   ]
}

JSON Response example


{ 
    "objectIdFieldName": "objectid", 
    "globalIdFieldName": "GlobalID", 
    "geometryType": "esriGeometryMultipatch", 
    "spatialReference": { 
        "wkid": 4326, 
        "latestWkid": 0, 
        "vcsWkid": 0, 
        "latestVcsWkid": 0, 
        "xyTolerance": 0, 
        "zTolerance": 0, 
        "mTolerance": 0, 
        "falseX": true, 
        "falseY": true, 
        "xyUnits": true, 
        "falseZ": true, 
        "zUnits": true, 
        "falseM": true, 
        "mUnits": true 
    }, 
    "fields": [ 
        { 
            "name": "objectid", 
            "type": "esriFieldTypeOID", 
            "alias": "Object ID" 
        }, 
        { 
            "name": "GlobalID", 
            "type": "esriFieldTypeUUID", 
            "alias": "Global ID" 
        }, 
        { 
            "name": "datetime", 
            "type": "esriFieldTypeDate", 
            "alias": "Earthquake Date", 
            "length": 36 
        }, 
        { 
            "name": "depth", 
            "type": "esriFieldTypeDouble", 
            "alias": "Depth" 
        }, 
        { 
            "name": "ESRI3DO_TYPE", 
            "type": "esriFieldTypeString", 
            "alias": "Asset Type", 
            "length": 16 
        }, 
        { 
            "name": "ESRI3DO_SHASH", 
            "type": "esriFieldTypeString", 
            "alias": "Source Hash", 
            "length": 80 
        }, 
        { 
            "name": "ESRI3DO_OX", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D asset origin X" 
        }, 
        { 
            "name": "ESRI3DO_OY", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D asset origin Y" 
        }, 
        { 
            "name": "ESRI3DO_OZ", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D asset origin Z" 
        }, 
        { 
            "name": "ESRI3DO_TX", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D translation X" 
        }, 
        { 
            "name": "ESRI3DO_TY", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D translation Y" 
        }, 
        { 
            "name": "ESRI3DO_TZ", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D translation Z" 
        }, 
        { 
            "name": "ESRI3DO_SX", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D scale X" 
        }, 
        { 
            "name": "ESRI3DO_SY", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D scale Y" 
        }, 
        { 
            "name": "ESRI3DO_SZ", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D scale Z" 
        }, 
        { 
            "name": "ESRI3DO_RX", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D rotation direction X" 
        }, 
        { 
            "name": "ESRI3DO_RY", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D rotation direction Y" 
        }, 
        { 
            "name": "ESRI3DO_RZ", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D rotation direction Z" 
        }, 
        { 
            "name": "ESRI3DO_RDEG", 
            "type": "esriFieldTypeDouble", 
            "alias": "3D rotation" 
        } 
    ], 
    "assetMapFields": [ 
        { 
            "name": "ESRI3DO_PID", 
            "type": "esriFieldTypeGUID", 
            "alias": "Feature GUID" 
        }, 
        { 
            "name": "ESRI3DO_FLAGS", 
            "type": "esriFieldTypeInteger", 
            "alias": "Asset Flags" 
        }, 
        { 
            "name": "ESRI3DO_NAME", 
            "type": "esriFieldTypeString", 
            "alias": "Asset Symbolic Name", 
            "length": 512 
        }, 
        { 
            "name": "ESRI3DO_TYPE", 
            "type": "esriFieldTypeString", 
            "alias": "Asset Type", 
            "length": 16 
        }, 
        { 
            "name": "ESRI3DO_SIZE", 
            "type": "esriFieldTypeInteger", 
            "alias": "Asset Size [bytes]" 
        }, 
        { 
            "name": "ESRI3DO_CPLX", 
            "type": "esriFieldTypeInteger", 
            "alias": "Asset Complexity" 
        }, 
        { 
            "name": "ESRI3DO_SIZE", 
            "type": "esriFieldTypeInteger", 
            "alias": "Asset size [bytes]" 
        }, 
        { 
            "name": "ESRI3DO_AHASH", 
            "type": "esriFieldTypeString", 
            "alias": "Asset hash", 
            "length": 80 
        }, 
        { 
            "name": "ESRI3DO_SHASH", 
            "type": "esriFieldTypeString", 
            "alias": "Source Hash", 
            "length": 80 
        }, 
        { 
            "name": "ESRI3DO_SEQNO", 
            "type": "esriFieldTypeInteger", 
            "alias": "Asset sequence number" 
        } 
    ], 
    "features": [ 
        { 
            "attributes": { 
                "objectid": 3745682, 
                "datetime": 1272210710000, 
                "depth": 31.1, 
                "eqid": "2010vma5", 
                "latitude": 33.8, 
                "longitude": -118.15, 
                "magnitude": 4.8, 
                "numstations": 112, 
                "region": "Andrean of Islands, Aleutian Islands, Alaska", 
                "source": "us", 
                "version": "Q", 
                "GlobalID": "{064185b3-d827-fa42-a9bb-aff1ccb9b6a1}", 
                "ESRI3DO_TYPE": "3D_glb", 
                "ESRI3DO_SHASH": "6486ee53c8faba18045ef29d382f1c8227bde3a25d37f7a62fe0d2259a3a14dd", 
                "ESRI3DO_OX": -118.15, 
                "ESRI3DO_OY": 33.8, 
                "ESRI3DO_OZ": -12, 
                "ESRI3DO_TX": 0, 
                "ESRI3DO_TY": 0, 
                "ESRI3DO_TZ": 0, 
                "ESRI3DO_SX": 1, 
                "ESRI3DO_SY": 1, 
                "ESRI3DO_SZ": 1, 
                "ESRI3DO_RX": 0, 
                "ESRI3DO_RY": 1, 
                "ESRI3DO_RZ": 0, 
                "ESRI3DO_RDEG": 0 
            }, 
            "geometry": { 
                "xmin": -109.55, 
                "ymin": 25.76, 
                "xmax": -86.39, 
                "ymax": 49.94, 
                "zmin": -12, 
                "zmax": 13.3 
            } 
        } 
    ] 
    "assetMaps": [ 
       { 
         "globalId": "{9db72076-e109-467e-94c7-3d5a3a4ef9ef}", 
         "parentGlobalId": "{064185b3-d827-fa42-a9bb-aff1ccb9b6a1}", 
         "assetName": "geometry.glb", 
         "assetHash": "6486ee53c8faba18045ef29d382f1c8227bde3a25d37f7a62fe0d2259a3a14dd", 
         "assetType": "3D_glb", 
         "flags": ["PROJECT_VERTICES"], 
         "conversionStatus": "COMPLETED", 
         "size": 8940, 
         "complexity": 354, 
         "sourceHash": "6486ee53c8faba18045ef29d382f1c8227bde3a25d37f7a62fe0d2259a3a14dd", 
         "assetURL": https://domain.esri.com/webadapter/rest/services/ESRI3DO/FeatureServer/0/6486ee53c8faba18045ef29d382f1c8227bde3a25d37f7a62fe0d2259a3a14dd.glb, 
         "seqNo": 0 
        } 
    ] 

}