Closed sahbijabnouni closed 5 years ago
@sahbijabnouni can you let me know which version of koop you are using, as well as the specific provider you have tried so I can attempt to reproduce?
I tested the koop provider simple project which is using 3.4
Stack:
C:\Users\sahbi\Desktop\koop-iasworld>cd C:\Users\sahbi\Downloads\koop-provider-sample-master
C:\Users\sahbi\Downloads\koop-provider-sample-master>npm install npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor. npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
farmhash@2.1.0 install C:\Users\sahbi\Downloads\koop-provider-sample-master\node_modules\farmhash prebuild-install || node-gyp rebuild
npm notice created a lockfile as package-lock.json. You should commit this file.
added 483 packages from 428 contributors and audited 1233 packages in 211.205s
found 1 low severity vulnerability
run npm audit fix
to fix them, or npm audit
for details
C:\Users\sahbi\Downloads\koop-provider-sample-master>node server.js WARNING: "/MapServer" routes will be registered, but only for specialized 404 handling in FeatureServer. {"level":"info","message":"registered output: Geoservices 2.0.0"} No root directory was specified, defaulting to: C:\Users\sahbi\Downloads\koop-provider-sample-master {"level":"info","message":"registered filesystem: localfs 1.1.1"} error=controller does not contain specified method method=get path=/datasets/:id handler=getFromCache
C:\Users\sahbi\Downloads\koop-provider-sample-master>npm -v 6.4.1
C:\Users\sahbi\Downloads\koop-provider-sample-master>node -v v8.12.0
C:\Users\sahbi\Downloads\koop-provider-sample-master>
@sahbijabnouni - thanks for bringing this to our attention. It was an issue only found on Windows deployments and caused by a recent change to koop-core. Specifically, we needed to create route paths using path.posix.join
in order to prevent errors on Windows.
I've fixed koop core and published version 3.10.1. I've also bumped the koop version in koop-provider-sample. To get the fix, you can download a fresh copy of koop-provider-sample and install, or bump the version of koop to 3.10.1 in your existing installs package.json, then do another npm install
.
Thanks rgwozdz for your answer.
I am writing a new koop provider and I want to custom the default url. Is it possible with the new version if yes, is there any doc? Requirement: instead of the default one /iasWorld/FeatureServer/:layer/:method': I want /iasWorld/:table/FeatureServer/:layer/:method
Read about Provider parameters in the section Request parameters in getData on the spec page. If you set hosts: false
, you will get default routes like
/iasWorld/:id/FeatureServer/:layer/:method
. Instead of req.params.table
, you would access it with req.params.id
.
I should amend my note above - I don't know exactly how you are setting this up, so I am making some guesses.
If you set hosts: true
you should get the following URL form:
/:host/:id/FeatureServer/:layer/:method
You could make that work in your provider by checking that req.params.host === 'iasWorld'
and then accessing your table name with req.params.id
.
Alternatively, you could set hosts: false
, but register the provider with the options object { routePrefix: 'iasWorld' }
. This would give you routes like:
/iasWorld/:id/FeatureServer/:layer/:method
Thanks rgwozdz
Hi rgwozdz, I have question about how to set spatialReference this is the default : "spatialReference": { "wkid": 4326, "latestWkid": 4326 }, we want to use different values
Do you mean that your data source is a spatial reference that is not 4326 and you also want it to be delivered in that same spatial reference?
yeah, this is a type of our special reference Spatial Reference: 102100 (3857)
Ok. Our provider specification notes that the getData
function should translate the data into GeoJSON and that the GeoJSON should be valid with respect to the GeoJSON specification. GeoJSON is technically only valid if the spatial reference is 4326. So the internals of Koop expect the data from the provider to be 4326 and we currently don't allow changing the spatial reference sent in server or layer info.
If the data coming out of your provider is something besides 4326 and you are using an ArcGIS client, you will likely run into problems consuming the koop data because the ArcGIS clients will read the server info and think it is in 4326.
The easiest work around would be to transform your data to 4326 in your provider. Koop honors the outSR
query parameters, so as long as the requests get a outSR=3857
your data would arrive in your client in the desired spatial reference.
Alternatively, you could put together a PR that allows source spatial reference to be controlled by provider metadata. We're always looking for contributors.
I have this issue when running any koop provider:
error=controller does not contain specified method method=get path=/datasets/:id handler=getFromCache