NYCPHP Meetup

NYPHP.org

[nycphp-talk] Zip code radius

CED consult at covenantedesign.com
Fri May 22 19:47:58 EDT 2009


Edward Potter wrote:
> Yep, Geocode a list of addresses, export lat, lng file. Suck into the 
> iPhone, parse the file, build a store locator that knows where I am, 
> link those pins to a mysql db, spit out some more xml soup.   Fun stuff.
>
> Mapkit 3.0 is wild. ;-)
>
> Search google + php + map + geocode
>
> On May 22, 2009, at 4:10 PM, Paul Guba <paul at gubavision.com> wrote:
>
>> There is actually a class available google it in includes basic 
>> script and database with zipcodes and long and lat points.  I think 
>> it even factors in for the curvature of the earth.  Used it a way back.
>>
>>
>> Paul Guba
>> paul at gubavision.com
>>
>>
>>
>> On May 22, 2009, at 4:04 PM, Aaron Fischer wrote:
>>
>>> Great stuff, thanks John!
>>>
>>> I got my Google API Key and am reading up on geocoding now  Never 
>>> tried something like this before so it looks like I've got some 
>>> learning to do.
>>>
>>> -Aaron
>>>
>>> On May 22, 2009, at 2:36 PM, John Campbell wrote:
>>>
>>>> I used to do a bit of GIS stuff.
>>>>
>>>> Here is what you need to do.
>>>>
>>>> 1) Import a list of zip codes & lat/lng centroids into your database.
>>>> The data is here:
>>>> http://www.census.gov/tiger/tms/gazetteer/zips.txt
>>>>
>>>> 2) Geocode all of your contacts, and store the lat/lng coordinates
>>>> with the contacts. Google has a free geocoding service.  You need a
>>>> google api key, and they only allow 10,000 queries per day per IP.
>>>> Depending on how many contacts you have, this may take several days to
>>>> get all of the coordinates.
>>>> The docs are here:
>>>> http://code.google.com/apis/maps/documentation/geocoding/index.html
>>>>
>>>> 3) Read up on the Haversine formula.
>>>> http://en.wikipedia.org/wiki/Haversine_formula
>>>>
>>>> Once you have these three pieces, you will be able to calculate the
>>>> distance between contacts and any zip code.
>>>>
>>>> Regards,
>>>> John Campbell
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, May 22, 2009 at 2:09 PM, Aaron Fischer <afischer at smith.edu> 
>>>> wrote:
>>>>> I'd like to build a feature that will allow someone to enter a zip 
>>>>> and a
>>>>> radius and have the page display all the contacts that are within the
>>>>> specified radius of that location.  (I have a db table to query 
>>>>> that has
>>>>> contacts and their address information, including zips.)
>>>>>
>>>>> Has anyone found a class or code that they like that will do this?
>>>>>
>>>>> Displaying results on a map would be a sweet bonus but is not 
>>>>> required.
>>>>>
>>>>> -Aaron
>>>>> _______________________________________________
>>>>> New York PHP User Group Community Talk Mailing List
>>>>> http://lists.nyphp.org/mailman/listinfo/talk
>>>>>
>>>>> http://www.nyphp.org/show_participation.php
>>>>>
>>>> _______________________________________________
>>>> New York PHP User Group Community Talk Mailing List
>>>> http://lists.nyphp.org/mailman/listinfo/talk
>>>>
>>>> http://www.nyphp.org/show_participation.php
>>>
>>> _______________________________________________
>>> New York PHP User Group Community Talk Mailing List
>>> http://lists.nyphp.org/mailman/listinfo/talk
>>>
>>> http://www.nyphp.org/show_participation.php
>>
>> _______________________________________________
>> New York PHP User Group Community Talk Mailing List
>> http://lists.nyphp.org/mailman/listinfo/talk
>>
>> http://www.nyphp.org/show_participation.php
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/show_participation.php
>
>
>
You may not really want afull blown geocoding etc.; you may want to look 
at somethign lighter like this: http://developer.yahoo.com/geo/placemaker/





More information about the talk mailing list