Workflow ############### 1) Start by downloading the administrative boundary data for the country in ESRI format from http://www.gadm.org/ country. For more information about administrative divisions of different countries, see https://en.wikipedia.org/wiki/Table_of_administrative_divisions_by_country There are multiple administrative levels --- cities may be nested in states which may be nested in countries. 2) Using `pyshp package `_ load 2nd level shapefile (IND_adm2.dbf and IND_adm2.shp), extract polylines of "NCT of Delhi" and build map data extract URL for http://extract.bbbike.org like the one for |delhi_link|. .. |delhi_link| raw:: html Delhi This is so that we don't need to set up our own OSM map server, which is extremely large. Get link to the extracted map data by e-mail or check the download status page: http://download.bbbike.org/osm/extract/ 3) Download and unzip it. There is a shapefile for road data in roads.*. Optionally we can drag and drop roads.* to view on http://www.mapshaper.org/. You'll see all roads map like this: .. image:: _images/india-delhi-roads-plot-all.png There are many types of roads found in the map data: 'primary', 'pedestrian', 'bridleway', 'secondary_link', 'tertiary', 'primary_link', 'service', 'residential', 'motorway_link', 'cycleway', 'secondary', 'living_street', 'track', 'motorway', 'construction', 'tertiary_link', 'trunk', 'path', 'trunk_link', 'rest_area', 'footway', 'unclassified', 'steps', and 'road' 4) Filter a few interesting road types and plot with matplotlib: .. image:: _images/india-delhi-roads-plot-selected-zoom-wgs84.png 5) Iterate through all selected road types and split the polyline into 500 meters segments. The following figure plots segmented polylines :- .. image:: _images/india-delhi-roads-plot-selected-segmented-zoom-wgs84.png 6) Write out all the segments to a CSV file.