https://github.com/missinglink/whosonthecouch
import whosonfirst data in to couchdb
https://github.com/missinglink/whosonthecouch
Last synced: 6 months ago
JSON representation
import whosonfirst data in to couchdb
- Host: GitHub
- URL: https://github.com/missinglink/whosonthecouch
- Owner: missinglink
- Created: 2017-08-03T11:28:34.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-03T12:34:03.000Z (almost 9 years ago)
- Last Synced: 2025-01-22T08:11:20.742Z (over 1 year ago)
- Size: 1000 Bytes
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# who's on the couch?
a quick'n'easy way to import whosonfirst data in to couchdb
### install couch db
```bash
docker run -p 5984:5984 -d couchdb
```
you now have a fancy GUI running at: http://localhost:5984/_utils/
### create an index
```bash
curl -X PUT http://localhost:5984/wof
```
### import all the data
```bash
find '/whosonfirst-data/data' -type f -name '*.geojson' | parallel --no-notice curl -s -XPUT "http://localhost:5984/wof/{/.}" -d "@{}"
```
### import only some of the data (advanced usage)
create a filter file which lists all the placetypes you're interested in (name it `placetype.filter`):
```bash
"wof:placetype":\s*"\(continent\|country\|dependency\|disputed\|macroregion\|region\|macrocounty\|county\|localadmin\|locality\|borough\|macrohood\|neighbourhood\)"
```
and then just add it to the pipeline:
```bash
function placetypeFilter {
while IFS= read -r FILENAME; do
grep --files-with-match -f "placetype.filter" "${FILENAME}" || true;
done
}
find '/whosonfirst-data/data' -type f -name '*.geojson' | placetypeFilter | parallel --no-notice curl -s -XPUT "http://localhost:5984/wof/{/.}" -d "@{}"
```