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,

mapdata <- getMapdata("cities.csv")

source: openstreetmap data


First Crowdsourced Project.


The Image above is a static screenshot of dynamic, interactive and crowdsourced map I created to map people from School of Planning and Architecture, Delhi and see how they are distributed all over the world. I initially circulated within my batch and later in a broader group and the response has been really good so far with the counter crossing 100 as of yesterday.Though it is not some thing really advanced or jaw dropping, I am really excited to see how easy it is to collect and visualize data (especially geographic) if one knows the right tools. The tools used are MySQL server, Apache (PHP) server, JavaScript (with jQuery), Google Maps API v3, Chrome and Sublimetext.

The visualisation is similar to what I did for the IRIS competition earlier but the difference is in the backend. Instead of reading a preset datafile and displaying it, this map here has a MySQL database in backend and queries it through PHP and visualises the result. It also has PHP based POST mechanism to send data to the database from the user. The best part is that none of the data in the image above is collected or entered by me (except for my two data points). It is rather generated by the people who individually entered their own locations.