Maps of real-world cities in graph representation (with nodes and edges)


Parse geojson files retrieved from Mapzen-OpenStreetMap

Generate graphs in gexf format for analysis and visualization

View the Project on GitHub ignacioarnaldo/OpenStreetMap2Graph

Generate graph representations (with nodes and edges) of real-world cities:

The goal of the project is to provide maps of real cities in a graph representation (with nodes and edges). Nodes are intersections between roads, points where roads change direction, or subway stations. We create an edge between two nodes whenever there is a road or railway that links them. If we zoom in Washington Square, NYC, this is what it looks like:

WSZ

Check out the examples of NYC, Boston, and the amazing Madrid:

The resulting graphs are big! For instance, the graph representation of NYC counts 98542 nodes and 114981 edges. For simplicity, we consider railways and roads separately.

City Mapzen - OpenStreetMap Snapshot of the roads Donwload PDF Donwload gexf file
New York City
NYC Roads PDF
Railways PDF
Roads GEXF
Railways GEXF
Boston
NYC Roads PDF
Railways PDF
Roads GEXF
Railways GEXF
Madrid
MADRID Roads PDF
Railways PDF
Roads GEXF
Railways GEXF

Tutorial

Step 1: Download geoJSON data

Download the geoJSON data of one of the cities available at mapzen.com

Step 2: Download the graphFromGeoJson.jar file from here

Step 3: Generate the graph

Six arguments need to be specified:

  1. path_to_map: path to the geojson file

  2. road_class: highway or railway

  3. minX: minimum x coordinate of the rectangle delimiting the city

  4. maxX: maximum x coordinate of the rectangle delimiting the city

  5. minY: minimum y coordinate of the rectangle delimiting the city

  6. maxY: maximum y coordinate of the rectangle delimiting the city

From the terminal:

$ java -jar graphFromGeoJson.jar path_to_map road_class minX maxX minY maxY > output.gexf
Example
$ java -jar graphFromGeoJson.jar new-york_new-york-roads.geojson railway -74.0969467163086 -73.8339614868164 40.70016219564594 40.85147526676901 > nyc_railway.gefx

Step 4: Visualization

We use Gephi for the visualizations.

Authors and Contributors

This project was developed by Ignacio Arnaldo (@ignacioarnaldo)