koopjs / FeatureServer

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

The OBJECTID field type is not set correctly #31

Closed jkerr5 closed 7 years ago

jkerr5 commented 7 years ago

When generating a layer descriptor response using field metadata from a provider, OBJECTID fields are set to type esriFieldTypeInteger.

My provider is setting the field type for the OBJECTID field to "Integer" and this results in a the type in the layer descriptor response to be esriFieldTypeInteger. If I do not include field metadata for OBJECTID, koop sets it to the correct type of esriFieldTypeOID.

Is there a type that the provider should specify in the metadata to indicate that the field is an OID?

dmfenton commented 7 years ago

Would you please post the full provider response, including metadata? It's ok to truncate the features array.

jkerr5 commented 7 years ago

This is a request for the layer resource so there is no features array. The URL requested is

/GDeltGKG/FeatureServer/0

The provider response is

{
  "metadata": {
    "maxRecordCount": 100000,
    "id": 0,
    "name": "Article GTD matches",
    "decription": "GDelt GKG article data that matches GTD events",
    "geometryType": "Point",
    "idField": "OBJECTID",
    "displayField": "url",
    "geometryPath": "\/geometry",
    "extent": {
      "xmin": -180,
      "ymin": -90,
      "xmax": 180,
      "ymax": 90,
      "spatialReference": {
        "wkid": 4326,
        "latestWkid": 4326
      }
    },
    "fields": [
      {
        "name": "OBJECTID",
        "type": "Integer"
      },
      {
        "name": "urlpubtimedate",
        "type": "Date"
      },
      {
        "name": "url",
        "type": "String"
      },
      {
        "name": "name",
        "type": "String"
      },
      {
        "name": "urltone",
        "type": "Double"
      },
      {
        "name": "sentiment",
        "type": "String"
      },
      {
        "name": "domain",
        "type": "String"
      },
      {
        "name": "urllangcode",
        "type": "String"
      },
      {
        "name": "geores",
        "type": "Integer"
      },
      {
        "name": "counter",
        "type": "Integer"
      },
      {
        "name": "attacktype",
        "type": "String"
      },
      {
        "name": "targettype",
        "type": "String"
      },
      {
        "name": "weapontype",
        "type": "String"
      },
      {
        "name": "eventid",
        "type": "String"
      },
      {
        "name": "eventsummary",
        "type": "String"
      }
    ]
  }
}

And the response from koop is

{
  "currentVersion": 10.31,
  "id": 0,
  "name": "Article GTD matches",
  "type": "Feature Layer",
  "description": "This is a feature service powered by https:\/\/github.com\/featureserver\/featureserver",
  "geometryType": "esriGeometryPoint",
  "copyrightText": " ",
  "parentLayer": null,
  "subLayers": null,
  "minScale": 0,
  "maxScale": 0,
  "drawingInfo": {
    "renderer": {
      "type": "simple",
      "symbol": {
        "color": [
          45,
          172,
          128,
          161
        ],
        "outline": {
          "color": [
            190,
            190,
            190,
            105
          ],
          "width": 0.5,
          "type": "esriSLS",
          "style": "esriSLSSolid"
        },
        "size": 7.5,
        "type": "esriSMS",
        "style": "esriSMSCircle"
      }
    },
    "labelingInfo": null
  },
  "defaultVisibility": true,
  "extent": {
    "xmin": -180,
    "ymin": -90,
    "xmax": 180,
    "ymax": 90,
    "spatialReference": {
      "wkid": 4326,
      "latestWkid": 4326
    }
  },
  "hasAttachments": false,
  "htmlPopupType": "esriServerHTMLPopupTypeNone",
  "displayField": "url",
  "typeIdField": null,
  "fields": [
    {
      "name": "OBJECTID",
      "type": "esriFieldTypeInteger",
      "alias": "OBJECTID",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "urlpubtimedate",
      "type": "esriFieldTypeDate",
      "alias": "urlpubtimedate",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "url",
      "type": "esriFieldTypeString",
      "alias": "url",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "name",
      "type": "esriFieldTypeString",
      "alias": "name",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "urltone",
      "type": "esriFieldTypeDouble",
      "alias": "urltone",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "sentiment",
      "type": "esriFieldTypeString",
      "alias": "sentiment",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "domain",
      "type": "esriFieldTypeString",
      "alias": "domain",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "urllangcode",
      "type": "esriFieldTypeString",
      "alias": "urllangcode",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "geores",
      "type": "esriFieldTypeInteger",
      "alias": "geores",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "counter",
      "type": "esriFieldTypeInteger",
      "alias": "counter",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "attacktype",
      "type": "esriFieldTypeString",
      "alias": "attacktype",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "targettype",
      "type": "esriFieldTypeString",
      "alias": "targettype",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "weapontype",
      "type": "esriFieldTypeString",
      "alias": "weapontype",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "eventid",
      "type": "esriFieldTypeString",
      "alias": "eventid",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    },
    {
      "name": "eventsummary",
      "type": "esriFieldTypeString",
      "alias": "eventsummary",
      "length": null,
      "editable": false,
      "nullable": true,
      "domain": null
    }
  ],
  "relationships": [

  ],
  "canModifyLayer": false,
  "canScaleSymbols": false,
  "hasLabels": false,
  "capabilities": "Query",
  "maxRecordCount": 100000,
  "supportsStatistics": true,
  "supportsAdvancedQueries": true,
  "supportedQueryFormats": "JSON",
  "ownershipBasedAccessControlForFeatures": {
    "allowOthersToQuery": true
  },
  "useStandardizedQueries": true,
  "advancedQueryCapabilities": {
    "useStandardizedQueries": true,
    "supportsStatistics": true,
    "supportsOrderBy": true,
    "supportsDistinct": true,
    "supportsPagination": false,
    "supportsTrueCurve": false,
    "supportsReturningQueryExtent": true,
    "supportsQueryWithDistance": true
  },
  "dateFieldsTimeReference": null,
  "isDataVersioned": false,
  "supportsRollbackOnFailureParameter": true,
  "hasM": false,
  "hasZ": false,
  "allowGeometryUpdates": true,
  "objectIdField": "OBJECTID",
  "globalIdField": "",
  "types": [

  ],
  "templates": [

  ],
  "hasStaticData": true
}

If there is a type I should be setting in the metadata for OBJECT that would result in its type being set to esriFieldTypeOID in the koop response, please let me know.

jkerr5 commented 7 years ago

In looking at a stack trace from another error, I happened to notice a typo in some winnow code. See line https://github.com/FeatureServer/winnow/blob/master/src/options.js#L38. Note the typo on the check for metadata.idFIeld.

I'm not sure if it's related to this but thought I would pass along anyway.

dmfenton commented 7 years ago

Fixed in winnow@1.10.6

dmfenton commented 7 years ago

Released in 2.3.11