Saturday, January 22, 2011

Finding Intersection of streets using Google Geocoding API

after releasing the Green Hong Kong to public and open source it,
my next step is to improve the accuracy of Recycle Bins location.

my last release was just blindly submitting the whole address (not an exact address) string to Google Map API and asked for possible locations.
First, i submit the chinese address.
if no response for chinese address, then i submit again with english address.

Using this way i got almost 99% latitude and longitude back.
BUT, most of them are not accurate.


There are variety of recycle bin addresses Government website provided.
e.g. near the MTR exit, outside XXX Building, opposite to the Bank, near the XXX Lamp Pole, etc.
basically the text is clear ... to me, but not the computer.
so i need to enhance the intelligent in determine nearest latitude and longitude of the recycle bins.


First case i want to tackle is the intersection case.
Government website told me that some recycle bins are located at the intersection of 2 streets.
my first thought is using simple maths to draw 2 straight lines and calculate the intersection.
i look at the Google Geocoding API,  see if there is any concrete data about the street.
then i find out that there is a Address Component Type called "intersection".
which is actually what i needed.

alright, I am getting lazy, because Google did everything for me already.

No comments:

Post a Comment