koopjs / FeatureServer

An open source Geoservices Implementation (deprecated)
https://geoservices.github.io
Other
104 stars 32 forks source link

Providers with metadata that includes an idField get faulty fields array #92

Closed rgwozdz closed 6 years ago

rgwozdz commented 6 years ago

If a provider denotes an idField in its metadata, the FeatureServers layer info service returns a fields array that contains both an OBJECTID field object as well as a separate object representing the provider's idField. For example, if the provider's metadata has idField: 'featureId' the the layer services field array will contain:

[       
  {
    "name": "OBJECTID",
    "type": "esriFieldTypeOID",
    "alias": "OBJECTID",
    "defaultValue": null,
    "domain": null,
    "editable": false,
    "nullable": false,
    "sqlType": "sqlTypeOther"
  },
  {
    "name": "featureId",
    "type": "esriFieldTypeInteger",
    "alias": "featureId",
    "defaultValue": null,
    "domain": null,
    "editable": false,
    "nullable": false,
    "sqlType": "sqlTypeOther"
  }
]

However, the query service squashes the two above field objects together into one object in the fields array.

{
  "name": "featureId",
  "type": "esriFieldTypeOID",
  "alias": "featureId",
  "sqlType": "sqlTypeOther",
  "domain": null,
  "defaultValue": null
}

The upshot is that the layer and query services have fields arrays of different lengths, and the query service doesn't have a field with name OBJECTID which causes client errors.

rgwozdz commented 6 years ago

Solved in 5897fa3a1c1799d90868fda27fb262b8d5b4fd84.