Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kontrollanten/couchdb-hastings-docker
CouchDB with geospatial index through hastings/easton
https://github.com/kontrollanten/couchdb-hastings-docker
couchdb easton geospatial hastings spatial-database spatial-index
Last synced: 3 months ago
JSON representation
CouchDB with geospatial index through hastings/easton
- Host: GitHub
- URL: https://github.com/kontrollanten/couchdb-hastings-docker
- Owner: kontrollanten
- License: mit
- Created: 2018-02-18T22:56:41.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-22T06:50:49.000Z (over 5 years ago)
- Last Synced: 2024-08-02T12:50:24.529Z (6 months ago)
- Topics: couchdb, easton, geospatial, hastings, spatial-database, spatial-index
- Language: Shell
- Homepage: https://hub.docker.com/r/kontrollanten/couchdb-hastings/
- Size: 7.81 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - kontrollanten/couchdb-hastings-docker - CouchDB with geospatial index through hastings/easton (others)
README
# CouchDB with geospatial index
Use CouchDB with geojson and spatial indexes.## Setup
```
docker run -d kontrollanten/couchdb-hastings
```## Run smoke tests
```
docker exec -w /couchdb/src/hastings/sample -t $(docker ps -q -f ancestor=kontrollanten/couchdb-hastings) python loader.py
>
```
## Usage### Create your geo json database
```
curl -X POST localhost:5984/shelters
```### Import some geo data
```
curl -X POST -H "Content-Type: application/json" -d '
{
"geometry": {
"type": "Point",
"coordinates": [59.37131802330678, 18.16711393757631]
},
"properties": {
"name": "Secret room",
"address": "Underground"
}
}
' localhost:5984/shelters
```### Create a spatial index
```
curl -X POST -H "Content-Type: application/json" -d '
{
"_id": "_design/SpatialView",
"st_indexes" : {
"shelter_positions": {
"index" : "function(doc) { if (doc.geometry) { st_index(doc.geometry); } }"
}
}
}' localhost:5984/shelters
```### Query geo data
```
curl -X GET localhost:5984/shelters/_design/SpatialView/_geo/shelter_positions?bbox=59.26,18.02,59.49,18.32{
"bookmark": "g1AAAALDeJyNkrtKA0EUQJdoIWojpEll8APCPDKvQjcg2S8QK1HnaQhRC7HWJlWwMQHL-Ak2ahkFwTYfIJjGxs4ijQjrjUGx2g0D82CGw-EwrSiKFhpzLlqxx6e24UwNE1FBMHALrgpH8zBH57CkadpvNgqHcCzrIFmVwEvDPZcSca6qgmBDkeAcIZXEvZPSwdLjOINsajCbPcD-UZGilmlCtPXSBsUlogQzIokVTBidxN3BzVq__Zbr-zD1ff0lU8KQpwhEreOws4Zq7CR1PhBDlUjizu6mYBcbWb77E9-zmXwDVs6ZJL5sf-7c17-yqOUJNZ6JqhXCtAoVxi-dUnE5t8JoWiHNr6CCdT997yrF295zBllHZvUf0gXvidETsFeUcW2UQBBVq8AcDfARulvbT8OrxVzZ66nsIF9WBOEUA_LwY330Xm9-AyjxyZs",
"rows": [
{
"id": "1ef78a34dacc85eee8657e625286ec3e",
"rev": "1-2d5ed349b3dda7973751532a0f7cfb1e",
"geometry": {
"type": "Point",
"coordinates": [
59.37131802330678,
18.16711393757631
]
}
}
]
}
```