Giter Site home page Giter Site logo

adebas / census-tracts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from developmentseed/census-tracts

0.0 2.0 0.0 1.11 MB

Illinois census tracts changes

Home Page: http://developmentseed.org/census-tracts/

JavaScript 86.75% HTML 2.90% Python 3.77% CSS 6.57%

census-tracts's Introduction

About

This one page mapping tool shows differences between 2000 and 2010 census tracts in Illinois.

Data Source

Tract relationships data is from Census relationship files.

Geo data is from Tiger shapefiles.

The detailed explanation of census tract changes provides helpful background reading.

Processing

process.py takes the CSV in the data folder and creates a 2000.json and 2010.json. The script takes each row of the CSV related to one tract, and create an object containing all related tracts from the alternate year. For example, it takes a 2010 tract and fills the object with all related 2000 tracts, as seen in this snippet from the 2010.json.

These files are then referenced in site.js when a user clicks on the map, to pull the appropriate 2000 tracts that appear under the 2010 tracts. See inline comments in script.js.

TopoJSON

Tiger shapefiles of Illinois tracts were converted to TopoJSON since GeoJSONs would take too long to load in the browser.

First install topojson (requires node)

npm install topojson

Then specify the input file, output file name, and any additional options. The topoJSONs used on this site are simplified to 20% quality to reduce file size. The ID of the features is also promoted to the top of the properties, so that it can later be referenced with the findwhere function in script.js.

topojson -s [input file name] -0 --simplify-proportion=0.2 --id-property=GEOID -o il_tracts_2000.json

The input shapefiles are not included in this repository since only TopoJSONs are used on the site.

See the command line reference for more options when creating TopoJSON files.

Limitations of TopoJSON

Since the TopoJSON is very simplified, it limits the tool's ability to detect fine changes. For example, tract 17111871500 is composed of parts of four 2000 tracts, two of which don't appear to fall within the 2010 border due to simplification.

The purple 2000 tract contributes 0 percent population and area because Census calculates all percentages to 2 decimal places.

Javascript

The site uses underscore.js, and jquery (included in ext folder).

Mapbox.js and Topojson libraries are referenced externally.

Inline comments in script.js explain functionality.

Contribute

Contributions to this site are welcome, please open a ticket for features, bugs or to discuss pull requests. Or fork the site to replicate the process for your own state.

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.