While doing GIS system integration I encountered a kind of response data that I have no experience with. The coordinates looked very strange, except for the first one, the rest were mostly [1, 1]
, [1, 0]
, [-1, 1]
or such. Is it some kind of relative values? How should I parse or convert them and eventually get the full absolute coordinate values?
The system was ArcGIS Server, and the response came from an API endpoint similar to https://<host-hidden>/arcgis/rest/services/<data-name-hidden>/MapServer/dynamicLayer/query
. The request data was:
f:json
returnGeometry:true
spatialRel:esriSpatialRelIntersects
geometry:{"xmin":13045108.007364817,"ymin":-60420.400090846495,"xmax":13045337.318449672,"ymax":-60191.08900599128,"spatialReference":{"wkid":102100}}
geometryType:esriGeometryEnvelope
inSR:102100
outSR:102100
quantizationParameters:{"mode":"view","originPosition":"upperLeft","tolerance":19,"extent":{"xmin":94.97199999930154,"ymin":-11.007615088964371,"xmax":141.01999999940153,"ymax":6.07694033193161,"spatialReference":{"wkid":4326,"latestWkid":4326,"vcsWkid":115700,"latestVcsWkid":115700}}}
layer:{"source":{"type":"mapLayer","mapLayerId":3}}
And the response data looked like this (please notice the features -> geometry -> rings
part):
{
"displayFieldName": "giskemendagri.gisadmin.<hidden>.<hidden>",
"transform": {
"originPosition": "upperLeft",
"scale": [
19,
19
],
"translate": [
94.971999999301545,
6.0769403319316098
]
},
"fieldAliases": {
"giskemendagri.gisadmin.<hidden>.<hidden>": "<hidden>"
},
"geometryType": "esriGeometryPolygon",
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"fields": [
{
"name": "giskemendagri.gisadmin.<hidden>.<hidden>",
"type": "esriFieldTypeString",
"alias": "<hidden>",
"length": 10
}
],
"features": [
{
"attributes": {
"giskemendagri.gisadmin.<hidden>.<hidden>": "<hidden>"
},
"geometry": {
"rings": [
[
[
686779,
3084
],
[
4,
69
],
[
1,
1
],
[
1,
0
],
[
1,
1
],
[
1,
0
],
[
1,
2
],
[
-1,
1
],
[
-1,
1
],
[
0,
1
],
[
-1,
1
],
[
-1,
1
],
[
1,
0
],
[
0,
1
],
[
-1,
1
],
[
0,
1
],
[
0,
2
],
[
0,
1
],
[
1,
1
],
[
-1,
82
],
[
-5,
0
],
[
-8,
0
],
[
-2,
14
],
[
0,
3
],
[
3,
1
],
[
0,
1
],
[
0,
1
],
[
6,
0
],
[
0,
7
],
[
-1,
9
],
[
0,
4
],
[
9,
0
],
[
5,
0
],
[
5,
1
],
[
3,
0
],
[
3,
0
],
[
3,
0
],
[
6,
1
],
[
5,
0
],
[
5,
0
],
[
6,
0
],
[
6,
0
],
[
7,
1
],
[
3,
0
],
[
7,
4
],
[
4,
2
],
[
4,
1
],
[
5,
3
],
[
4,
1
],
[
3,
1
],
[
2,
1
],
[
0,
5
],
[
0,
3
],
[
1,
2
],
[
1,
2
],
[
0,
2
],
[
2,
4
],
[
1,
2
],
[
0,
1
],
[
0,
1
],
[
0,
3
],
[
0,
1
],
[
0,
1
],
[
-1,
1
],
[
0,
3
],
[
0,
3
],
[
-2,
10
],
[
3,
7
],
[
1,
1
],
[
3,
3
],
[
6,
2
],
[
-21,
12
],
[
-2,
0
],
[
-2,
0
],
[
-1,
0
],
[
-5,
0
],
[
-1,
0
],
[
-2,
0
],
[
-2,
0
],
[
-2,
-1
],
[
-1,
0
],
[
-2,
0
],
[
-3,
0
],
[
-1,
0
],
[
-2,
0
],
[
-1,
0
],
[
-2,
0
],
[
-1,
0
],
[
-1,
0
],
[
0,
-1
],
[
-1,
0
],
[
-1,
-1
],
[
-1,
0
],
[
-2,
0
],
[
-1,
-1
],
[
-2,
0
],
[
-1,
0
],
[
-1,
0
],
[
-2,
-1
],
[
-1,
-1
],
[
-1,
0
],
[
-1,
0
],
[
0,
-1
],
[
-1,
0
],
[
-1,
0
],
[
-1,
-1
],
[
-1,
0
],
[
0,
-1
],
[
-1,
0
],
[
-1,
0
],
[
-1,
-1
],
[
-1,
0
],
[
-2,
-1
],
[
-1,
0
],
[
-1,
-1
],
[
-2,
-1
],
[
-1,
0
],
[
-2,
-1
],
[
-1,
0
],
[
-1,
-1
],
[
-1,
0
],
[
-1,
-1
],
[
-1,
0
],
[
-1,
0
],
[
-1,
0
],
[
-1,
-1
],
[
-1,
0
],
[
-1,
0
],
[
-1,
-1
],
[
-1,
0
],
[
-3,
-2
],
[
-1,
0
],
[
-1,
-1
],
[
-1,
-1
],
[
-1,
-1
],
[
-1,
0
],
...(cropped due to question length limitation)
]
]
}
}
]
}
Best Answer
Yes, those are relative values. It's part of coordinate quantization to make the queries as small as possible (and thus faster), as well as the clientside parsing and implementation faster and better in the ArcGIS API for JavaScript. You can read more about coordinate quantization at https://developers.arcgis.com/rest/services-reference/enterprise/query-feature-service-layer-.htm and https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#quantizationParameters
No, you probably shouldn't parse them. Instead change the query to return the coordinates in the format you want. It might be as simple as removing the
quantizationParameters
property in the REST request.