GithubHelp home page GithubHelp logo

shakythesherpa / geostack-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from erictheise/geostack-api

0.0 2.0 0.0 1.38 MB

A quick & dirty Node/Express application to serve GeoJSON from OpenStreetMap data imports.

Home Page: http://erictheise.github.io/deck-geo-stack-deep-dive

License: MIT License

geostack-api's Introduction

geostack-api

This is a quick & dirty Node/Express application that's used in conjunction with my Let's Talk About Your Geostack workshop & deck. It's the result of a basic Express scaffold, with /routes/users.js deleted, /routes/amenities.js added, and /app.js adjusted accordingly.

Requirements

The requirements for this to work are that

  1. you have Node and npm installed

  2. there's a spatially-enabled (PostgreSQL + PostGIS) database running on localhost

  3. the database contains OpenStreetMap data, likely a metro extract

  4. the data import was done with osm2pgsql and included all tags, meaning that --hstore-all was used, e.g.

    osm2pgsql -H localhost --hstore-all -d portland_from_osm ~/Downloads/portland.osm.pbf
    

Motivation

The workshop demonstrates how all components of a contemporary web mapping application can be run locally, on your own computer, using open source software and open data. OpenStreetMap data is used with TileMill and TileStream to generate and serve map tiles as a base layer, and with Leaflet to generate map overlays for points of interest.

The dynamic.html page in a companion repo, geostack-map-pages, consumes data from this api in order to create and display a Leaflet GeoJSON Layer.

Use

  1. git clone this repository.

  2. cd geostack-api

  3. npm install

  4. alter line 11 of /routes/amenities.js to account for your database name and authentication parameters. The general form is

    pg://user_name:user_password@localhost:port_number/database_name
    
  5. npm start

  6. visit or make an AJAX call to http://localhost:3000/amenities/ to retrieve a GeoJSON FeatureCollection of restaurants and their cuisines

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -123.201866018855,
                    45.2027315841557
                ]
            },
            "properties": {
                "name": "El Primo",
                "cuisine": null
            }
        },
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -123.192975122993,
                    45.2237749069396
                ]
            },
            "properties": {
                "name": "Chan's Restuarant",
                "cuisine": "chinese"
            }
        },
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -122.230128012966,
                    45.3831193176103
                ]
            },
            "properties": {
                "name": "Calamity Jane's",
                "cuisine": "burger"
            }
        }
    ]
}

geostack-api's People

Contributors

erictheise avatar

Watchers

 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.