koopjs / koop

Transform, query, and download geospatial data on the web.
http://koopjs.github.io
Other
651 stars 125 forks source link

FeatureServer: Allow objectIds values that are not integers #803

Closed rgwozdz closed 9 months ago

rgwozdz commented 9 months ago

By ArcGIS standards, OBJECTIDs should be integers in range 0 to 2,147,483,647. ArcGIS datasets/services must have an OBJECTID field or another field that represents the unique-identifier (identified in the layer's fields definitions by type esriFieldTypeOID); otherwise, these service usually don't work well or at all in ArcGIS clients.

For Koop, the requirement that the unique identifier be an integer can be problematic, as many datasets and data-stores have moved away from sequenced integers as primary keys. In such situations, developers generally let Koop create OBJECTIDs on the fly (by numeric hash of the the feature). But doing so limits the ability to implement a "pass-through" pattern; any "filter by objectId" operation (which is common in identify and zoomTo operations) cannot be handed off to the provider's remote API, since OBJECTIDs don't exist on the dataset itself. This would mean the entire dataset would need to fetched so the Koop could filter it down to a single record with the matching, programmatically generated OBJECTID. At best inefficient, as worst, the entire dataset may not be able to be fetched.

However, it has recently been observed that when consuming services with the ArcGIS JavaScript API, the unique-identifier can be a string. Koop currently can't take advantage of that, because it rejects non-integer values in the objectIds query param. We should remove this restriction, and make any other adjustments required to support string-type unique identifiers. While these Koop services may not work in all ArcGIS clients, they would be useful for those using the JavaScript API.

rgwozdz commented 9 months ago

Added in https://github.com/koopjs/koop/pull/804.