without lat and long

1 view
Skip to first unread message

Kovo

unread,
Jun 20, 2008, 12:18:17 AM6/20/08
to Google Maps EZ
Im using current version of GmapEZ which is 2.4, and Im trying to pass
the location url like this:
http://maps.google.com/maps?f=q&hl=en&geocode=&q=4965+Rue+Harry-Worth,+Pierrefonds,+QC,+Canada

however gmapEZ dsnt work if u dont specify the lat and long

is there a way around this?

Thanks

adrian...@creativewebsolutions.com.mx

unread,
Jun 20, 2008, 12:53:53 AM6/20/08
to Google Maps EZ
I don´t think GMapEZ can do that? you can only pass lat lon data with
URL...

Kovo

unread,
Jun 20, 2008, 9:40:52 AM6/20/08
to Google Maps EZ
Well I dont want to define lat and long at all.
I want to create a php application that takes an address and plots its
position on google maps using gmapEZ. But I cannot obviously determine
the lat and long of the location.
Using the Google MAPs site you CAN specify an address without lat and
long but on gmapEZ you cannot. Too bad. Any ideas?

Brad

unread,
Jun 24, 2008, 4:12:04 PM6/24/08
to Google Maps EZ
I'm just getting into using gmapEZ but I've been using the gmap API
for awhile.

You can geocode the address to get the lat/long.

To help you get going, the following code (which I found on the Google
Maps site) will allow you to get the lat/long from a given address.

You still need to add or modify the rest of the code for this to work
with gmapEZ.

I hope this helps point you in the right direction.

// Initialize delay in geocode speed
$delay = 0;
define("KEY", "Use-Your-Code-Here");

$base_url = "http://maps.google.com/maps/geo?output=csv&key=" . KEY;
$geocode_pending = true;
while ($geocode_pending) {
// $address=$city.', '.$state.', '.$zip.', '.$country;
$address=$city.', '.$state.', '.$country;
$request_url = $base_url . "&q=" . urlencode($address);
$csv = file_get_contents($request_url) or die("url not loading");

$csvSplit = split(",", $csv);
$geocode_status = $csvSplit[0];
$lat = $csvSplit[2];
$lng = $csvSplit[3];
if (strcmp($geocode_status, "200") == 0) {
// successful geocode
$geocode_pending = false;
$lat = mysql_real_escape_string($lat);
$lng = mysql_real_escape_string($lng);
}
else if (strcmp($geocode_status, "620") == 0) {
// sent geocodes too fast
$delay += 100000;
}
else {
// failure to geocode
$geocode_pending = false;
$lat = 0;
$lng = 0;
}
usleep($delay);
}

Reply all
Reply to author
Forward
0 new messages