Coder Social home page Coder Social logo

phearzero / couchdb-hastings-docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kontrollanten/couchdb-hastings-docker

1.0 2.0 0.0 8 KB

CouchDB with geospatial index through hastings/easton

Home Page: https://hub.docker.com/r/kontrollanten/couchdb-hastings/

License: MIT License

Dockerfile 47.10% Shell 52.90%

couchdb-hastings-docker's Introduction

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
<bound method Response.json of <Response [200]>>

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
        ]
      }
    }
  ]
}

couchdb-hastings-docker's People

Contributors

kontrollanten avatar phearzero avatar

Stargazers

Richard Cook avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.