Unstoppable Domains

[Resolved] Geo coding Help

Spaceship Spaceship
Watch

Ray

VIP Member
Impact
167
Geo coding Help

Im am working on a website that will index restaurants in the United States. I seem to be stuck on search for the end-user. I was wondering if anyone could help me.

Basically, I want the user to be able to search for a restaurant in an (x) amount of miles from there zipcode. Now i understand that this task is caled geo coding. Meaning, I have to get the latitude and logitude coordinates from a particular address.

I was wondering if anyone knows a free script that i could use or if anyone knows how to accomplish this task.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
1
•••
I have a database with every zip code in the United States with the corisponding information such as town, city, state, and latitude and logitude. I was looking for an address base...

SO basically, i need a script that will determine the cordinates on an address.

Ive been looking throught the google maps api, it looks like it can do the job.. but i dont want to be involved with all the tos..



EX: Search within 5 miles of zip 33333

Address street, town, city, is 3.2m from zip.
 
Last edited:
0
•••
your best bet would be to have a close look at the pdf i supplied the link too and look how they calculate the distance, You can then translate that into sql and use it within a queries where clause (stating the distance should not be over x)
 
0
•••
I solved my own problem.. I used Google Maps API. I coded the following script.

PHP:
<?php

$addressfind = "address here";

$key = "api key here";
$addresssend = urlencode($addressfind);
$url = "http://maps.google.com/maps/geo?q=".$addresssend."&output=csv&key=".$key;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER[‘HTTP_USER_AGENT’]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$data = curl_exec($ch);
curl_close($ch);
if (strstr($data,'200'))
{
$data = explode(",",$data);

$precision = $data[1];
$latitude = $data[2];
$longitude = $data[3];

echo "Latutide: ".$latitude." Longitude: ".$longitude;

} 

else 

{
echo "There was an error in your request!";
}

?>
 
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back