-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0e940e1
Showing
14 changed files
with
206,044 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
# Auto detect text files and perform LF normalization | |||
* text=auto | |||
|
|||
# Custom for Visual Studio | |||
*.cs diff=csharp | |||
*.sln merge=union | |||
*.csproj merge=union | |||
*.vbproj merge=union | |||
*.fsproj merge=union | |||
*.dbproj merge=union | |||
|
|||
# Standard to msysgit | |||
*.doc diff=astextplain | |||
*.DOC diff=astextplain | |||
*.docx diff=astextplain | |||
*.DOCX diff=astextplain | |||
*.dot diff=astextplain | |||
*.DOT diff=astextplain | |||
*.pdf diff=astextplain | |||
*.PDF diff=astextplain | |||
*.rtf diff=astextplain | |||
*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,163 @@ | |||
################# | |||
## Eclipse | |||
################# | |||
|
|||
*.pydevproject | |||
.project | |||
.metadata | |||
bin/ | |||
tmp/ | |||
*.tmp | |||
*.bak | |||
*.swp | |||
*~.nib | |||
local.properties | |||
.classpath | |||
.settings/ | |||
.loadpath | |||
|
|||
# External tool builders | |||
.externalToolBuilders/ | |||
|
|||
# Locally stored "Eclipse launch configurations" | |||
*.launch | |||
|
|||
# CDT-specific | |||
.cproject | |||
|
|||
# PDT-specific | |||
.buildpath | |||
|
|||
|
|||
################# | |||
## Visual Studio | |||
################# | |||
|
|||
## Ignore Visual Studio temporary files, build results, and | |||
## files generated by popular Visual Studio add-ons. | |||
|
|||
# User-specific files | |||
*.suo | |||
*.user | |||
*.sln.docstates | |||
|
|||
# Build results | |||
[Dd]ebug/ | |||
[Rr]elease/ | |||
*_i.c | |||
*_p.c | |||
*.ilk | |||
*.meta | |||
*.obj | |||
*.pch | |||
*.pdb | |||
*.pgc | |||
*.pgd | |||
*.rsp | |||
*.sbr | |||
*.tlb | |||
*.tli | |||
*.tlh | |||
*.tmp | |||
*.vspscc | |||
.builds | |||
*.dotCover | |||
|
|||
## TODO: If you have NuGet Package Restore enabled, uncomment this | |||
#packages/ | |||
|
|||
# Visual C++ cache files | |||
ipch/ | |||
*.aps | |||
*.ncb | |||
*.opensdf | |||
*.sdf | |||
|
|||
# Visual Studio profiler | |||
*.psess | |||
*.vsp | |||
|
|||
# ReSharper is a .NET coding add-in | |||
_ReSharper* | |||
|
|||
# Installshield output folder | |||
[Ee]xpress | |||
|
|||
# DocProject is a documentation generator add-in | |||
DocProject/buildhelp/ | |||
DocProject/Help/*.HxT | |||
DocProject/Help/*.HxC | |||
DocProject/Help/*.hhc | |||
DocProject/Help/*.hhk | |||
DocProject/Help/*.hhp | |||
DocProject/Help/Html2 | |||
DocProject/Help/html | |||
|
|||
# Click-Once directory | |||
publish | |||
|
|||
# Others | |||
[Bb]in | |||
[Oo]bj | |||
sql | |||
TestResults | |||
*.Cache | |||
ClientBin | |||
stylecop.* | |||
~$* | |||
*.dbmdl | |||
Generated_Code #added for RIA/Silverlight projects | |||
|
|||
# Backup & report files from converting an old project file to a newer | |||
# Visual Studio version. Backup files are not needed, because we have git ;-) | |||
_UpgradeReport_Files/ | |||
Backup*/ | |||
UpgradeLog*.XML | |||
|
|||
|
|||
|
|||
############ | |||
## Windows | |||
############ | |||
|
|||
# Windows image file caches | |||
Thumbs.db | |||
|
|||
# Folder config file | |||
Desktop.ini | |||
|
|||
|
|||
############# | |||
## Python | |||
############# | |||
|
|||
*.py[co] | |||
|
|||
# Packages | |||
*.egg | |||
*.egg-info | |||
dist | |||
build | |||
eggs | |||
parts | |||
bin | |||
var | |||
sdist | |||
develop-eggs | |||
.installed.cfg | |||
|
|||
# Installer logs | |||
pip-log.txt | |||
|
|||
# Unit test / coverage reports | |||
.coverage | |||
.tox | |||
|
|||
#Translations | |||
*.mo | |||
|
|||
#Mr Developer | |||
.mr.developer.cfg | |||
|
|||
# Mac crap | |||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
v20130201 - February 01, 2013 | |||
|
|||
First Open Source Release. | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
Copyright (c) 2013 City of Chicago | |||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |||
|
|||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,124 @@ | |||
README | |||
====== | |||
The City of Chicago is releasing selected datasets from the [data portal](http://data.cityofchicago.org, 'Chicago Data Portal') under the MIT License (see below). This repository contains: | |||
1. Data in a GeoJSON format. | |||
2. Examples of importing data into R, Python, and Ruby. | |||
3. Instructions to transform data from the data portal to data in the repository. | |||
|
|||
Working with GeoJSON Data | |||
========================= | |||
The data was released as a [GeoJSON](http://www.geojson.org/geojson-spec.html) file. Below are some simple instructions which will show you how to load GeoJSON in R, Python, and Ruby. | |||
|
|||
R | |||
--- | |||
Find an example script [here](/examples/Importing%20GeoJSON%20R%20Demo.R, 'Importing GeoJSON data to R'). This example will import the data in R and create a couple of maps. | |||
|
|||
Instructions: | |||
|
|||
1. Set the working directory to the location of the downloaded repository. | |||
```r | |||
setwd("path\\to\\repository\\folder") | |||
``` | |||
|
|||
2. Install the "rgdal" library to let R read and translate the data from GeoJSON to a Shapefile. We will use "ggplot2" library to transform the spatial data frame to a regular data frame--and to make a map. | |||
|
|||
```r | |||
install.packages(c("rgdal","ggplot2")) | |||
``` | |||
|
|||
3. Load the libraries: | |||
```r | |||
library(rgdal) | |||
library(ggplot2) | |||
``` | |||
|
|||
4. Import data to a spatial dataframe. City data is typically created using the transverse Mercator projection. | |||
```r | |||
ogrInfo("data\\Bikeroutes.json", layer="OGRGeoJSON") | |||
bikeroutes.shapefile <- readOGR(dsn="data\\Bikeroutes.json", layer="OGRGeoJSON", p4s="+proj=tmerc +ellps=WGS84") | |||
``` | |||
|
|||
5. Ensure the map works: | |||
```r | |||
plot(bikeroutes.shapefile) | |||
``` | |||
|
|||
6. Lets convert the spatial dataframe to a typical dataframe. | |||
```r | |||
bikeroutes.table <- fortify(bikeroutes.shapefile) | |||
``` | |||
|
|||
7. Review the new dataframe. | |||
```r | |||
head(bikeroutes.table) | |||
``` | |||
|
|||
8. Plot the data. | |||
```r | |||
ggplot(bikeroutes.table, aes(x=long, y=lat, group=group)) + geom_path() | |||
``` | |||
|
|||
Here is the output you should expect from the plot() command: | |||
![plot(bikeroutes.shapefile)](/examples/R-plot-bike-routes.png) | |||
Here is the outout you should expect from the ggplot() command: | |||
![ggplot(bikeroutes.df, aes(x=long, y=lat, group=group))+geom_path()](/examples/R-ggplot-bike-routes.png) | |||
|
|||
Python | |||
------ | |||
Find an example script [here](/examples/Importing%20GeoJSON%20Python%20Demo.py, 'Importing GeoJSON data to Python Demo'). | |||
|
|||
1. Load the necessary json and pprint libraries. | |||
```python | |||
import json | |||
``` | |||
|
|||
2. Open GeoJSON data file. | |||
```python | |||
bikeroutes_json = open('PATH/TO/osd-street-center-line/data/Bikeroutes.json', 'r') | |||
``` | |||
|
|||
3. Check first few lines of data (repeat this command several times) | |||
```python | |||
bikeroutes.readline() | |||
``` | |||
|
|||
4. Load GeoJSON file. | |||
```python | |||
bikeroutes = json.load(bikeroutes_json) | |||
``` | |||
|
|||
5. Close the open GeoJSON file. | |||
```python | |||
json.close(bikeroutes_json) | |||
``` | |||
|
|||
Ruby | |||
---- | |||
|
|||
An example ruby script is provided to show loading GeoJSON and running spatial analysis using the RGeo suite. A simple Gemfile is provided to make getting the dependencies and using them easy. | |||
|
|||
$ cd PATH/TO/osd-bike-routes/examples/ruby | |||
$ bundle | |||
$ ruby example.rb | |||
|
|||
This example script filters the `Bikeroutes.json` to street segments within a 500ft buffer of 50 W Washington. | |||
|
|||
|
|||
Differences between data portal and this repository | |||
=================================================== | |||
Though the data in this repository is also available on Chicago's data portal, the data in this repository is different in several ways. First, the data within this repository is released under the MIT License. Second, this data has been edited to remove internal codes which do not provide useful information. Third, after changes were made to the dataset, the original shapefile was converted to GeoJSON using [GDAL's](http://www.gdal.org/, 'Geospatial Data Abstraction Library') [ogr2ogr](http://www.gdal.org/ogr2ogr.html) | |||
|
|||
The resulting shapefile is then translated to GeoJSON using the ogr2ogr from the GDAL application. The transformation is completed in the command prompt: | |||
```bat | |||
ogr2ogr -f "GeoJSON" Bikeroutes_ogr.json /path/to/portal/data/Bikeroutes3.shp | |||
``` | |||
Unfortunately, ogr2ogr outputs in machine, but not human-readable files. We use Python's simplejson.tool to transform the data to the final JSON file. | |||
```bat | |||
type Bikeroutes_ogr.json | python -m simplejson.tool > Bikeroutes.json | |||
``` | |||
|
|||
The folder "Transformations" contains the necessary code to transform data on the portal to the release in this repository. | |||
|
|||
License | |||
======= | |||
This data is released under the [MIT License](http://opensource.org/licenses/MIT, 'MIT License'). See LICENSE.txt. |
Oops, something went wrong.