I'm querying the ArcGIS REST API and I'm trying to write a request that includes a wildcard. The normal request (without wildcard) looks like this:
https://serviciosgis.catastrobogota.gov.co/arcgis/rest/services/ordenamientoterritorial/catastro/MapServer/6/query?f=json&where=ESOCLOTE=%22005611022010%22&spatialRel=esriSpatialRelIntersects&geometry={%22xmin%22:-8248284.5749014811590314,%22ymin%22:523903.3499047987861559,%22xmax%22:-8248034.5749014811590314,%22ymax%22:524153.3499047987861559,%22spatialReference%22:{%22wkid%22:102100,%22latestWkid%22:3857}}&outFields=*
This one works, and returns a valid json object with one feature. However, if I include a wildcard with virtually the same parameters it doesn't return anything. Here's the request with the wildcard:
https://serviciosgis.catastrobogota.gov.co/arcgis/rest/services/ordenamientoterritorial/catastro/MapServer/6/query?f=json&where=ESOCLOTE+like+%22005611022010%22&spatialRel=esriSpatialRelIntersects&geometry={%22xmin%22:-8248284.5749014811590314,%22ymin%22:523903.3499047987861559,%22xmax%22:-8248034.5749014811590314,%22ymax%22:524153.3499047987861559,%22spatialReference%22:{%22wkid%22:102100,%22latestWkid%22:3857}}&outFields=*
Am I writing the request correctly?
The first one says where=ESOCLOTE=%22005611022010%22
(this works) and the second one says where=ESOCLOTE+like+%22005611022010%22
(this doesn't work).
Any ideas?
1 Answer 1
I find ArcGIS REST APIs HTML interface quite helpful in this regards. If you change f=json
to f=html
, this will give you more user friendly interface to test your queries. As for your question, the API call below should work:
https://serviciosgis.catastrobogota.gov.co/arcgis/rest/services/ordenamientoterritorial/catastro/MapServer/6/query?where=ESOCLOTE+LIKE+%27005611022010%27&text=&objectIds=&time=&geometry=%7B%22xmin%22%3A-8248284.5749014811590314%2C%22ymin%22%3A523903.3499047987861559%2C%22xmax%22%3A-8248034.5749014811590314%2C%22ymax%22%3A524153.3499047987861559%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&returnTrueCurves=false&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&resultOffset=&resultRecordCount=&queryByDistance=&returnExtentsOnly=false&datumTransformation=¶meterValues=&rangeValues=&f=json
As far as I know SQL query for string data type expects enclosing single quotes, i.e., %27.