koopjs / FeatureServer

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

Normalize Spatial Reference rejects valid outSR from ArcGIS #189

Closed lawriege closed 3 years ago

lawriege commented 3 years ago

After recently upgrading from Koop 3 to 4 I noticed that Web Mercator (3857) requests were no longer working from ArcGIS Pro. As such, I did some further digging and the feature service was logging a "WARNING: [object Object] is not a valid spatial reference; defaulting to none" error. From here I narrowed it down to the normalizeSpatialReference method and the Joi validation which was throwing a "ValidationError: "xyTolerance" is not allowed" (once I allowed the error to throw).

Long story short I believe the Joi validation is too strict and needs to ignore extra properties e.g. }).unknown().or('wkid', 'latestWkid', 'wkt')

Test Case that should pass as outSR object is a valid request from ArcGIS it('wkid 102100 extra properties', () => { const spatialRef = normalizeSpatialReference({ wkid: 102100, latestWkid: 3857, xyTolerance: 0.001, zTolerance: 0.001, mTolerance: 0.001, falseX: -20037700, falseY: -30241100, xyUnits: 10000, falseZ: -100000, zUnits: 10000, falseM: -100000, mUnits: 10000 }) spatialRef.should.deepEqual({ latestWkid: 3857, wkid: 102100 }) })

rgwozdz commented 3 years ago

@lawriege - you're PR has been merged and released. Closing.