Home

Mapping building footprints of Indian cities with OpenStreetMap and R

Recently I revisited work I did in 2012 (aosm.r)  where I made a function to extract features from OpenStreetMap data into R for plotting and analysis. When I was fixing the download links in the old script, I realised that it would be interesting to make building footprints for Indian cities. Spent a day on it and the results are below (click on thumbnail for high resolution image). The input data needed is a csv file with the following data (sample linked at the end of the post),

  1. Name of the city in mapzen osm metro extracts
  2. Latitude and longitude of the centre of the city
  3. Extent to which we want the city to be mapped (in km) from centre and
  4. Clean name of the city which will be printed on the map.

The required scripts and data are,

  1. cities.csv
  2. aosm.r
  3. cities.r

Once we have the required files in the working directory, we can plot the cities by,

[code language=”R”]
source("cities.r")
mapdata <- getMapdata("cities.csv")
plotMaps(mapdata,5000,"#e41a1c")
[/code]

source: openstreetmap data

One thought on “Mapping building footprints of Indian cities with OpenStreetMap and R”

Leave a Reply

Your email address will not be published. Required fields are marked *