This is a discussion on Help needed in converting street address to latitude and longitudepair within the PHP Language forums, part of the PHP Programming Forums category; Hi All, I am building a web site with PHP and MySql where i have to convert the residential address ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi All,
I am building a web site with PHP and MySql where i have to convert the residential address registered by user in to latitude and longitude pair and also for addresses of hotels , hospitals etc,,,, sitting in MySQL DB.Finally i have to calculate the distance between the user's residential address and various places like hospital , hotels ,etc,, and sort the same in ascending order. I need help in converting the street address in to latitude/longitude pair. Thanks & Regards Noor Mohamed |
|
|||
|
On Dec 18, 12:05 pm, jaffy <jaffersola...@gmail.com> wrote:
> Hi All, > > I am building a web site with PHP and MySql where i have to convert > the residential address registered by user in to latitude and > longitude pair and also for addresses of hotels , hospitals etc,,,, > sitting in MySQL DB.Finally i have to calculate the distance between > the user's residential address and various places like hospital , > hotels ,etc,, and sort the same in ascending order. > > I need help in converting the street address in to latitude/longitude > pair. > > Thanks & Regards > Noor Mohamed The GoogleMap code below translates addresses into Lng/Lat based on postcode. There's probably something in the API (http://code.google.com/apis/ maps/documentation/reference.html) for calculating the distance as well. function GmapLoad() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.enableScrollWheelZoom(); geocoder = new GClientGeocoder(); showAddress("NW9 0HD","VITOW LTD<br>7 Carlisle Road<br>Colindale<br>London   ;NW9 0HD"); window.focus(); } } function showAddress(address,info) { geocoder.getLatLng(address, function(point) { if (!point) { alert("Could not find postcode " + address); } else { map.setCenter(point, 13); var marker = new GMarker(point); map.addOverlay(marker); marker.openInfoWindowHtml(info); } } ); } |
|
|||
|
On Dec 18, 12:57 pm, Rob <ratkin...@tbs-ltd.co.uk> wrote:
> On Dec 18, 12:05 pm, jaffy <jaffersola...@gmail.com> wrote: > > > Hi All, > > > I am building a web site with PHP and MySql where i have to convert > > the residential address registered by user in to latitude and > > longitude pair and also for addresses of hotels , hospitals etc,,,, > > sitting in MySQL DB.Finally i have to calculate the distance between > > the user's residential address and various places like hospital , > > hotels ,etc,, and sort the same in ascending order. > > > I need help in converting the street address in to latitude/longitude > > pair. > > > Thanks & Regards > > Noor Mohamed > > The GoogleMap code below translates addresses into Lng/Lat based on > postcode. > > There's probably something in the API (http://code.google.com/apis/ > maps/documentation/reference.html) for calculating the distance as > well. > > function GmapLoad() { > if (GBrowserIsCompatible()) { > map = new GMap2(document.getElementById("map")); > map.addControl(new GSmallMapControl()); > map.addControl(new GMapTypeControl()); > map.enableScrollWheelZoom(); > > geocoder = new GClientGeocoder(); > showAddress("NW9 0HD","VITOW LTD<br>7 Carlisle > Road<br>Colindale<br>London   ;NW9 0HD"); > window.focus(); > } > > } > > function showAddress(address,info) { > geocoder.getLatLng(address, > function(point) { > if (!point) { > alert("Could not find postcode " + address); > } else { > map.setCenter(point, 13); > var marker = new GMarker(point); > map.addOverlay(marker); > marker.openInfoWindowHtml(info); > } > } > ); > > > > }- Hide quoted text - > > - Show quoted text - The Google API is - http://code.google.com/apis/maps/doc...ml#GDirections, which offers a getDistance() method. This can only be called within the context of a visible map within the browser, so you're probably going to have to resort to paying for this info. BTW, Google Maps API is not licenced for Commercial use, so be careful what you plug it into. |
|
|||
|
Rob wrote:
> On Dec 18, 12:05 pm, jaffy <jaffersola...@gmail.com> wrote: >> Hi All, >> >> I am building a web site with PHP and MySql where i have to convert >> the residential address registered by user in to latitude and >> longitude pair and also for addresses of hotels , hospitals etc,,,, >> sitting in MySQL DB.Finally i have to calculate the distance between >> the user's residential address and various places like hospital , >> hotels ,etc,, and sort the same in ascending order. >> >> I need help in converting the street address in to latitude/longitude >> pair. >> >> Thanks & Regards >> Noor Mohamed > Which country is this in? |