Code Monkey home page Code Monkey logo

geojson-streetmaps's Introduction

RethinkDB streetmaps demo

This project shows off how geospatial queries can be used to display map data, as well as identify points of interest based on a given location.

First, clone the repository locally:

$ git clone https://github.com/rethinkdb/geojson-streetmaps.git

Next, you'll need to set up a free Mapbox account. This provides the background imagery needed in the demo.

After that, you'll need to install all the dependencies and load the example data. The makefile needs your Mapbox api key to build:

$ make API_KEY=$API_KEY

The make file will:

  • install the required nodejs packages
  • build the javascript bundle with browserify
  • install the server's required python packages
  • Create a new database called geojson_streetmaps
    • You can configure this with by setting the $DB environment variable
  • Create two new tables in that database:
    • streets, which contains all street geometry excluding points of interest
    • points_of_interest, just points of interest data
  • Load the two included json files into those tables

Optionally, before you run make you can set a few environment variables to customize where the data gets stored:

$ export RDBHOST=localhost       # hostname of your RethinkDB server
$ export RDBPORT=28015           # port of your RethinkDB server
$ export DB=geojson_streetmaps   # database to create and import into

All of the above are the defaults, customize them as you will.

To run the server do:

$ python server.py

The server process will use the same environment variables as the Makefile, but it also accepts commandline flags:

$ python server.py --help
usage: server.py [-h] [--port PORT] [--rdbhost RDBHOST] [--rdbport RDBPORT]
                 [--db DB]

optional arguments:
  -h, --help         show this help message and exit
  --port PORT        Port server should run on
  --rdbhost RDBHOST  RethinkDB hostname to connect to
  --rdbport RDBPORT  RethinkDB port to connect to
  --db DB, -d DB     Database to use (default: geojson_streetmaps)

Data sources and libraries used

The app uses Mapbox for the map imagery. The points of interest and street/county geometry comes from OpenStreetMap

The frontend uses uses the leaflet library, as well as jquery, to display the geometry on top of the map data. The backend is built with the tornado web server, and makes use of the more-itertools library.

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.