gozoober Posted June 2, 2008 Share Posted June 2, 2008 Hi, I am sure this has been asked before but I could not find it. Basically I have a database with property listings along with latitudes and longitudes for each property. Is there a php script that can tell me the location when it's passed the latitude and longitude so I know the location that each property is in? Thanks, Richard Link to comment https://forums.phpfreaks.com/topic/108453-finding-location-from-latitude-and-longitude/ Share on other sites More sharing options...
DarkWater Posted June 2, 2008 Share Posted June 2, 2008 Use a WHERE clause in your query with the latitude and longitude values. Link to comment https://forums.phpfreaks.com/topic/108453-finding-location-from-latitude-and-longitude/#findComment-556021 Share on other sites More sharing options...
gozoober Posted June 2, 2008 Author Share Posted June 2, 2008 I don't have the locations, I would like to use the Latitude and Longitude to identify the location, does that make sense? Link to comment https://forums.phpfreaks.com/topic/108453-finding-location-from-latitude-and-longitude/#findComment-556028 Share on other sites More sharing options...
DarkWater Posted June 2, 2008 Share Posted June 2, 2008 Yes, it makes sense, read what I said. Use a WHERE clause in your query with the latitude and longitude values. Link to comment https://forums.phpfreaks.com/topic/108453-finding-location-from-latitude-and-longitude/#findComment-556029 Share on other sites More sharing options...
discomatt Posted June 2, 2008 Share Posted June 2, 2008 I believe he wants to perform a reverse geocode. http://www.google.ca/search?q=reverse+geocode+php Link to comment https://forums.phpfreaks.com/topic/108453-finding-location-from-latitude-and-longitude/#findComment-556042 Share on other sites More sharing options...
chronister Posted June 2, 2008 Share Posted June 2, 2008 As far as writing it... I have no idea.. but I needed a store locator for the new website I am creating for my job and found a great google mapping tool at code322.com. It is not super cheap, but it is very good. You can pass an address string or lat/lon Thats the best I can do for ya. Yes, it makes sense, read what I said. Use a WHERE clause in your query with the latitude and longitude values. DarkWater, I am not sure what you mean by this. Just adding a where clause is not going to accomplish what the poster wants. Could you explain more for both my benefit and the original posters benefit? Nate Link to comment https://forums.phpfreaks.com/topic/108453-finding-location-from-latitude-and-longitude/#findComment-556090 Share on other sites More sharing options...
jonsjava Posted June 3, 2008 Share Posted June 3, 2008 try this code out. change the $daddr to pull the data from your db <?php $daddr= "some_GPS_code"; ?> <form name="form1"> Enter your address: <!-- input field where the user can enter the source address--> <input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" /> <br> <!-- html button with a javascript function attached to it to show the directions in the iframe--> <INPUT value="Get Directions" TYPE="SUBMIT" onclick="javascript:GetDirections();return false;"> <BR> <BR> <!-- the iframe to show the directions, this is invisible when the page first loads, since the source attribute is empty --> <iframe id="mapframe" name="mapframe" src="" frameborder="0" width="640px" height="480px"> </iframe> </form> <script language="javascript"> function GetDirections() { var SourceAdress = 'saddr='; var DestinationAddress = 'daddr=<?php print $daddr; ?>'; //hardcoded value for the destination address var Url = ''; //read out source adress from the input field SourceAdress += document.form1.saddr.value; //form the url Url = 'http://maps.google.com/maps?' + SourceAdress + '&' + DestinationAddress; // + '&output=html'; //open url in iframe frames['mapframe'].location.href = Url; //you can use the line below to show the directions in a popup window, don;t forget to comment out the line above... //window.open(Url,'directions','width=1024,height=768,scrollbars=yes,toolbar=no,location=no, resizable=no'); } </script> Hope this helps Link to comment https://forums.phpfreaks.com/topic/108453-finding-location-from-latitude-and-longitude/#findComment-556225 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.