Closed WillEngler closed 8 years ago
@WillEngler I was able to get it going by following the instructions here:
Check on the second block in “usage” here https://github.com/koopjs/koop-opendata replace openData:services with socrata:services
Thanks for following up @sirws. I've given up on playing with Koop for the time being, but I'll report back if/when I try again.
Summary:
I've cloned the sample app and I'm trying to pull down some Socrata data, but I'm unable to register a host. It seems like this is because Koop is trying to query a table that doesn't exist. When I use the local cache, I can add a host, but I can't get a dataset from that host.
Details:
When I perform a
github/
query likehttp://localhost:1337/github/chelm/grunt-geo/forks
it seems to work fine. A new table is created in my local postgres database the expected GeoJSON is returned.When I query
/socrata
, I get the helpful suggestion to POST a host. But when I use the one-liner example in the README (curl --data "host=https://data.nola.gov&id=nola" localhost:1337/socrata
) the following error is printed:{"name":"error","length":107,"severity":"ERROR","code":"42P01","position":"31","file":"parse_relation.c","line":"986","routine":"parserOpenTable"}
To make sure there wasn't something weird going on with my shell, I made a little Python script to make the request. Same outcome.
Some Googling shows that 42P01 is a postgres error meaning "Table does not exist".
Then I tried disabling PGCache in the sample app's server.js so I could default to the in-memory cache. Now I can successfully add a host! (I added New Orleans as shown in the README.) Then I tried using the sample query on the README:
http://localhost:1337/socrata/nola/fwm6-d78i
This stack trace got printed to the console:
TypeError: Cannot read property 'info' of undefined at Object.module.exports.getInfo (/Users/willengler/Sandbox/koop-sample-app/node_modules/koop/lib/Local.js:62:35) at Cache.getInfo (/Users/willengler/Sandbox/koop-sample-app/node_modules/koop/lib/Cache.js:178:13) at /Users/willengler/Sandbox/koop-sample-app/node_modules/koop-socrata/models/Socrata.js:167:20 at /Users/willengler/Sandbox/koop-sample-app/node_modules/koop/lib/Cache.js:133:23 at Object.module.exports.select (/Users/willengler/Sandbox/koop-sample-app/node_modules/koop/lib/Local.js:34:7) at Cache.get (/Users/willengler/Sandbox/koop-sample-app/node_modules/koop/lib/Cache.js:132:13) at Object.socrata.getResource (/Users/willengler/Sandbox/koop-sample-app/node_modules/koop-socrata/models/Socrata.js:165:16) at /Users/willengler/Sandbox/koop-sample-app/node_modules/koop-socrata/controller/index.js:69:17 at /Users/willengler/Sandbox/koop-sample-app/node_modules/koop-socrata/models/Socrata.js:49:9 at Object.module.exports.serviceGet (/Users/willengler/Sandbox/koop-sample-app/node_modules/koop/lib/Local.js:159:7)
But then there was this hopeful message:
info: Processing: https://data.nola.gov/resource/fwm6-d78i.json?$order=:id&$limit=10000&$offset=1 info: Processing: https://data.nola.gov/resource/fwm6-d78i.json?$order=:id&$limit=10000&$offset=1 info: Beginning to page through https://data.nola.gov/resourcefwm6-d78i 1 Pages. info: Beginning to page through https://data.nola.gov/resourcefwm6-d78i 1 Pages. info: Finished paging Socrata:fwm6-d78i:0
Subsequent GETs to
http://localhost:1337/socrata/nola/fwm6-d78i
give me something like{"checked_at":"2015-09-28T17:38:39.725Z"}
instead of the data I'm expecting.Am I doing something wrong?
Config:
For reference, here's the contents of my default.json file:
{ "server": { "port": 1337 }, "data_dir": "/usr/local/koop/", "db": { "conn": "koop://localhost/koop_test" } }
I've deleted the https config file.