koopjs / koop

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

Cannot access providers without DB cache configured #191

Closed timwis closed 8 years ago

timwis commented 9 years ago

Hey guys!

I've followed the instructions in the readme to set up koop on my ubuntu server. I provided an empty config object as the instructions suggest it's not necessary to provide a path to the DB (it just won't cache anything).

// create a config object that tells koop where to write data and what db to use
var config = {};

// pass the config to koop
var koop = require('koop')(config);

// require and register the provider to bind its routes and handlers
var ckan = require('koop-ckan');
koop.register(ckan);

// create an express app
var app = require('express')();

// add koop middleware to the express app
app.use(koop);

// start the express server
app.listen(process.env.PORT || 1337, function () {
  console.log('Listening at http://localhost:%d/', this.address().port);
});

I then POST my CKAN providerwithcurl --data "host=https://opendataphilly.org&id=phl" localhost:1337/ckanand I'm getting the errorCannot read property 'host' of undefined` when I try to access a CKAN dataset endpoint.

Do I need to provide a postgres path in the config or something?

chelm commented 9 years ago

Hi @timwis Can you tell me the version of koop that you have installed? I just ran the code you posted and it looks like it worked, so Im really curious as to what's up.

Thanks!

chelm commented 9 years ago

Also you are correct that if you dont pass it a DB connection it will not persist its cache across server sessions (so if you stop your server all data will be lost). It will be using koop's "local cache" which is just an in-memory object.

chelm commented 9 years ago

@timwis actually I re-read your issue and I think this looks like a bug in the either the ckan provider or koop's local cache. I'll look at it right now.

chelm commented 9 years ago

okay actually I had an error in my url. Following your steps above all seems to be working for me.

I get data at http://localhost:1337/ckan/phl/bicycle-thefts/FeatureServer/0

timwis commented 9 years ago

Thanks - I must have been missing /phl/ in the URL (doh...) but I got it to work with phl/heart-healthy-screening-sites - though when I try /phl/bicycle-thefts per your example I get an error Unable to retrieve data from https://opendataphilly.org/datastore/dump/f9809381-76f6-4fca-8279-621e088ddaa0 Feel free to close this issue though since that's probably different.