Skip to content

Draw an area and view geodata inside that neighborhood as an interactive map, time-enabled KML, or GeoJSON

Notifications You must be signed in to change notification settings

codeforamerica/geodata-checkout

Repository files navigation

GeoData-Checkout

GeoData-Checkout is an open data platform for geospatial and time-enabled data. Data is stored inside MongoDB (or PostGIS fork) and made available to users in an interactive timeline/map, time-enabled KML for Google Earth, and GeoJSON.

Demo

Step 1: Draw a polygon around your neighborhood ( using Leaflet.js polygon editing tools )

Step 2: Click the "View Web Map" link and you will land on an interactive timeline-map ( powered by Mapbox.js )

Step 3: Download options include KML or GeoJSON. When you open the KML file in Google Earth, it will open a timeline control.

Technology

About MongoDB

MongoDB is a NoSQL database which supports geospatial queries. The drawn polygon is saved as a CustomGeo, and its points are used to make this query:

timepoint.TimePoint.find( {
  ll: {
    "$within": {
      "$polygon": poly
    }
  }
})

If you prefer to use PostgreSQL / PostGIS, use this fork

Other technologies used

Leaflet.js from Cloudmade, MapBox.js from MapBox, Leaflet.js Pan Control, Node.js

Historic Buildings: Macon & Chicago

The timeline code was repurposed to show a building timeline for Historic Macon.

The Historic Chicago app uses neighborhood-drawing and timeline components to make sense of 400,000+ buildings and build dates from the City of Chicago

Source Code

About Poang

Poang (github) is a Node.js/MongoDB app built using the Express framework. Poang uses Everyauth for local authentication, Mongoose-Auth to connect Everyauth to MongoDB (and Mongoose as the ODM) for account persistence, and Connect-Mongo as a session store. Most of the code in app.js was generated by Express and all of the code in auth.js after the Comment schema is straight from the Mongoose-Auth docs.

For testing, Poang uses the Mocha test framework, should for assertions, Sinon.JS for mocks & stubs, and Zombie.js for lightweight integration testing.

For more details, please see BeyondFog's blog post that walks through the various tests in Poang.

Installation

  1. Do a git clone:

    git clone git://github.com/codeforamerica/geodata-checkout.git

  2. cd into the project directory and then install the necessary node modules:

    npm install -d

  3. start up MongoDB if it's not already running:

    mongod --noprealloc --nojournal

  4. start the node process:

    node app.js

  5. add a geospatial index to the "ll" field in your MongoDB settings

Deploy to Heroku

heroku create APP_NAME
git push heroku master

After you have created a new app on Heroku and pushed the code via git, you will need to use the Heroku Toolbelt from your command line to add the free MongoLab starter addon:

heroku addons:add mongolab:starter

Go to Heroku, click on Apps and then on this app's Addons panel. On the MongoLab admin panel, add a geospatial index to the "ll" field

Uploading data

POST each of your TimePoints to /timeline using a script such as https://gist.github.com/3853444

POST body should include these variables:

  • lat = latitude
  • lng = longitude
  • start = StartMonth
  • end = EndMonth

About

Draw an area and view geodata inside that neighborhood as an interactive map, time-enabled KML, or GeoJSON

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published