Here is what I have
- The population data aggregated by zip code given by US Census.
Here is what I am doing right now:
- Reverse geo code the center point to find the zip code of the center point.
- Associate a lat-long to each zip-code(by reverse geocoding, I know this will be error prone).
- Find the lat-longs(zip-codes) which are inside the circle, using Geokit-Rails plugin.
- Finding the sum of the data for those zip-codes(zip-code=zipcode of the center point or distance(between lat-long of the zip code and center point) < radius) and showing.
Am I doing this right? Is there methods efficient than this to find the population? Is there any algorithm already available?
I am using geokit-rails plugin for reverse geocoding and for finding the zip-codes(with associated lat-longs) within the circle.
The problem with this setup is that the zipcodes cannot be actually represented by the lat-long,it is an area.So, I am not sure the lat-long pair given by Google Map API is actually lies in the center of the zip code or something like that. Also,for radius 0 to almost 2.4 miles radius,the population remains same with this setup. That is, even for a radius of 0.1 miles, it will show the whole population of the zip code.I am looking for a way to approximate this.
I have asked same question in SO. Please have a look at this question also.