koopjs / koop

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

Line feature generalization with esri js sdk #675

Closed bmoregeo closed 1 year ago

bmoregeo commented 1 year ago

This is a strange one. I've noticed when we have poly line responses out of koop, they are being generalized by the javascript sdk. The response from koop has un-generalized lines, but something in the payload is telling the JS sdk to generalize the line into strange shapes.

I've attached two images. One with zoomed in and one with zoomed out. The geometries are not lining are going all wack-a-doo in the map view. I feel like something in the response back from koop is telling the js sdk to do this. Is anyone else experiencing this?

This is using koop 9.2 amd esri js sdk 4.27.

/query?f=json

{
    "currentVersion": 11.1,
    "fullVersion": "11.1.0",
    "id": 0,
    "name": "Not Set",
    "type": "Feature Layer",
    "description": "This is a feature service exposed with Koop. For more information go to https://github.com/koopjs/koop.",
    "copyrightText": "Copyright information varies by provider. For more information please contact the source of this data.",
    "parentLayer": null,
    "subLayers": null,
    "defaultVisibility": true,
    "hasAttachments": false,
    "htmlPopupType": "esriServerHTMLPopupTypeNone",
    "displayField": "objectid",
    "typeIdField": null,
    "fields": [{
        "name": "OBJECTID",
        "type": "esriFieldTypeOID",
        "alias": "OBJECTID",
        "sqlType": "sqlTypeInteger",
        "domain": null,
        "defaultValue": null,
        "editable": false,
        "nullable": false
    }],
    "relationships": [],
    "capabilities": "Query",
    "maxRecordCount": 2000,
    "supportsStatistics": true,
    "supportsAdvancedQueries": true,
    "supportedQueryFormats": "JSON",
    "ownershipBasedAccessControlForFeatures": {
        "allowOthersToQuery": true
    },
    "useStandardizedQueries": true,
    "advancedQueryCapabilities": {
        "useStandardizedQueries": true,
        "supportsStatistics": true,
        "supportsOrderBy": true,
        "supportsDistinct": true,
        "supportsPagination": true,
        "supportsTrueCurve": false,
        "supportsReturningQueryExtent": true,
        "supportsQueryWithDistance": true
    },
    "canModifyLayer": false,
    "dateFieldsTimeReference": null,
    "isDataVersioned": false,
    "supportsRollbackOnFailureParameter": true,
    "hasM": false,
    "hasZ": true,
    "allowGeometryUpdates": true,
    "objectIdField": "objectid",
    "globalIdField": "",
    "types": [],
    "templates": [],
    "hasStaticData": false,
    "timeInfo": {},
    "uniqueIdField": {
        "name": "objectid",
        "isSystemMaintained": true
    },
    "minScale": 0,
    "maxScale": 0,
    "canScaleSymbols": false,
    "drawingInfo": {
        "renderer": {
            "type": "simple",
            "symbol": {
                "color": [247, 150, 70, 204],
                "width": 6.999999999999999,
                "type": "esriSLS",
                "style": "esriSLSSolid"
            }
        },
        "labelingInfo": null
    },
    "extent": {
        "xmin": -118.358855,
        "xmax": 5,
        "ymin": 0,
        "ymax": 42.40873301200003,
        "spatialReference": {
            "wkid": 4326,
            "latestWkid": 4326
        }
    },
    "supportsCoordinatesQuantization": false,
    "hasLabels": false,
    "geometryType": "esriGeometryPolyline"
}

query?f=json&geometry=%7B%22xmin%22%3A-9598044.767713493%2C%22ymin%22%3A5107216.481903989%2C%22xmax%22%3A-9588260.828092992%2C%22ymax%22%3A5117000.421524489%7D&maxAllowableOffset=19.10925707128908&orderByFields=objectid&outFields=*&outSR=102100&resultType=tile&returnExceededLimitFeatures=false&spatialRel=esriSpatialRelIntersects&where=1%3D1&geometryType=esriGeometryEnvelope&inSR=102100

{
    "objectIdFieldName": "objectid",
    "uniqueIdField": {
        "name": "objectid",
        "isSystemMaintained": true
    },
    "globalIdFieldName": "",
    "hasZ": true,
    "hasM": false,
    "spatialReference": {
        "wkid": 102100,
        "latestWkid": 3857
    },
    "fields": [{
        "name": "OBJECTID",
        "type": "esriFieldTypeOID",
        "alias": "OBJECTID",
        "sqlType": "sqlTypeInteger",
        "domain": null,
        "defaultValue": null
    }],
    "features": [{
        "attributes": {
            "objectid": 0
        },
        "geometry": {
            "paths": [
                [
                    [-9598943.799094567, 5117342.171011585, 315],
                    [-9598937.172947884, 5117291.195909942, 315],
                    [-9598930.546801198, 5117240.22107936, 315],
                    [-9598923.920654513, 5117189.246519822, 315],
                    [-9598917.294507828, 5117138.272231336, 315],
                    [-9598910.668361142, 5117087.298213883, 315],
                    [-9598904.042214457, 5117036.324467476, 315],
                    [-9598897.416067772, 5116985.350992096, 315],
                    [-9598890.789921086, 5116934.377787742, 315],
                    [-9598884.163774401, 5116883.404854411, 315]
                ]
            ],
            "hasZ": true
        }
    }, {
        "attributes": {
            "objectid": 1
        },
        "geometry": {
            "paths": [
                [
                    [-9598020.082752667, 5113678.981680149, 315],
                    [-9598016.916687693, 5113632.548871026, 315],
                    [-9598013.75062272, 5113586.116286694, 315],
                    [-9598010.584557747, 5113539.683927154, 315],
                    [-9598007.418492774, 5113493.2517924, 315],
                    [-9598004.2524278, 5113446.819882428, 315],
                    [-9598000.980827326, 5113398.840478266, 315],
                    [-9597997.920297852, 5113353.956736817, 315],
                    [-9597994.754232878, 5113307.525501168, 315],
                    [-9597991.588167906, 5113261.094490289, 315]
                ]
            ],
            "hasZ": true
        }
    }, {
        "attributes": {
            "objectid": 2
        },
        "geometry": {
            "paths": [
                [
                    [-9595409.558799887, 5110104.0942025175, 315],
                    [-9595368.92997918, 5110115.399779997, 315],
                    [-9595328.301158473, 5110126.705370796, 315],
                    [-9595287.672337763, 5110138.010974917, 315],
                    [-9595247.043517057, 5110149.316592355, 315],
                    [-9595206.414696349, 5110160.622223116, 315],
                    [-9595164.431581616, 5110172.30472223, 315],
                    [-9595125.15705493, 5110183.233524602, 315],
                    [-9595084.528234223, 5110194.539195324, 315],
                    [-9595043.899413515, 5110205.844879365, 315]
                ]
            ],
            "hasZ": true
        }
    }],
    "exceededTransferLimit": false,
    "geometryType": "esriGeometryPolyline"
}

in out

rgwozdz commented 1 year ago

@bmoregeo, thank you for reaching out. Before we dig into this, have you confirmed that this doesn't occur with the same data being served by a genuine ArcGIS Server (like a ArcGIS online service)? If possible, push a sample your polyline dataset to ArcGIS Online as a hosted feature service and try connecting to that with arcgis js sdk. Do you observe different behavior?

bmoregeo commented 1 year ago

@rgwozdz , I did some testing. I think this is another strange arcgis js sdk quirk and not koop, but I think it does indicate some better documentation on what providers are expected to provide. It would be handy to dictate some of the common query parameters like returnZ, count, extent, where, etc.

What happened with the above: We have z enabled data. We were not handling the "returnZ" query parameter in the data provider. We were just sending all requests with "hasZ": true in the metadata and including the z coords on the geometry. I guess the esri js sdk had a fit over the response have z value.

rgwozdz commented 1 year ago

@bmoregeo - I see, thanks for checking and following up. I'm going to close this; if you like, you can open another issue for better docs on pass-through providers. They could use an update if not a total remodel.