Microfinance in India: Getting a sense of the geographic distribution

September 3, 2011
By

(This article was first published on Freigeist Blog - Jakobsweg, Pilgern und London » R, and kindly contributed to R-bloggers)

I am working on a review paper on microfinance in India and use data from the MIX market. Today, I was amazed by how quick I conjured a map of India with the headquarters of the microfinance institutions that report data to the MIX market depicted on that map. Ideally, I would have more geolocation data – but this is hard to come by. But what we can clearly see is the clustering of institutions in big cities and in the south, which was hit hardest by the recent crisis.

Microfinance Institutions across India

 

I dont think anybody has produced such a map before. In fact, I can do this for all institutions reporting data around the world, which may be interesting to see. Also, I already tried to make the size of the dot proportional to e.g. measures of real yield or color-coding the nearest neighborhood (say the neigbhouring districts) by the average loan sizes reported. Lots of things to do. Maybe thats something for the guys at MIX Market or for David Roodman who, I think has finished his open book.

The key difficulty was actually not in plotting the map (though it took some time), but in obtaining geo-data on where the headquarters of the microfinance institutions are located. I managed to obtain this data – though its not perfect – by making calls to the Google MAP API via a PHP script., basically using the following two functions:

function ResponseToArray($response) {

	return json_decode($response,true);
}

function findLocation($string) {

	$url = "http://maps.google.com/maps/geo?q=".$string."&output=json&sensor=true_or_false&key=your_api_key";

	$raw = file_get_contents($url);

	$geodata = ResponseToArray($raw);

	$point = $geodata["Placemark"][0]["Point"]["coordinates"];

return $point;

}

The first one transforms the JSON return into an array and the latter, actually does the call. The variable $string should contain the actual paramters, such as the city and the zip code of where the institution is located.

 

To leave a comment for the author, please follow the link and comment on his blog: Freigeist Blog - Jakobsweg, Pilgern und London » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.