koopjs / FeatureServer

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

Too many fields in query featureset response #34

Closed phpmaps closed 7 years ago

phpmaps commented 7 years ago

@jkerr5 @dmfenton

For a koop query request, we get back invalid fields. Notice the outFields in the request.

Here is the request params.

f:json geometry:{"xmin":-13633964.480821775,"ymin":4540069.018923454,"xmax":-13618753.512193045,"ymax":4553904.1210430525} geometryType:esriGeometryEnvelope inSR:102100 spatialRel:esriSpatialRelIntersects outFields:date,OBJECTID //NOTICE WE ONLY ASK FOR 2 FIELDS (date, OBJECTID) returnGeometry:true maxAllowableOffset:38 outSR:102100 resultOffset:0 resultRecordCount:1000 where:1=1

Instead of Koop returning just the fields requested, it will send back additional (all the fields) in the response.

Here is a sample response. Notice the fields list contains too many fields (per above request).

{
    "objectIdFieldName": "OBJECTID",
    "globalIdFieldName": "",
    "hasZ": false,
    "hasM": false,
    "geometryType": "esriGeometryPoint",
    "spatialReference": {
        "wkid": 102100,
        "latestWkid": 3857
    },
    "fields": [{
        "name": "date",
        "type": "esriFieldTypeDate",
        "alias": "date",
        "length": null,
        "editable": false,
        "nullable": true,
        "domain": null
    }, {
        "name": "description",
        "type": "esriFieldTypeString",
        "alias": "description",
        "length": null,
        "editable": false,
        "nullable": true,
        "domain": null
    }, {
        "name": "title",
        "type": "esriFieldTypeString",
        "alias": "title",
        "length": null,
        "editable": false,
        "nullable": true,
        "domain": null
    }, {
        "name": "OBJECTID",
        "type": "esriFieldTypeOID",
        "alias": "ID",
        "length": null,
        "editable": false,
        "nullable": false,
        "domain": null
    }],
    "features": [{
        "type": "Feature",
        "attributes": {
            "date": 1045440000000,
            "OBJECTID": 1
        },
        "geometry": {
            "x": -13628245.578950467,
            "y": 4551415.036767305
        }
    }, {
        "type": "Feature",
        "attributes": {
            "date": 1045526400000,
            "OBJECTID": 2
        },
        "geometry": {
            "x": -13627745.45678585,
            "y": 4549486.239246354
        }
    }, {
        "type": "Feature",
        "attributes": {
            "date": 1045612800000,
            "OBJECTID": 3
        },
        "geometry": {
            "x": -13627759.946509149,
            "y": 4548404.142409862
        }
    }, {
        "type": "Feature",
        "attributes": {
            "date": 1045699200000,
            "OBJECTID": 4
        },
        "geometry": {
            "x": -13624472.414064351,
            "y": 4542558.103199204
        }
    }]
}
thomas-hervey commented 7 years ago

@phpmaps this should be fixed in featureserver@2.3.12

thomas-hervey commented 7 years ago

@phpmaps Note, I may have accidentally pushed to phpmaps-phpmaps/fix-too-many-fields as well

phpmaps commented 7 years ago

@tomtom92 - all good. thanks!