I put some error coding in this script which i think is right.
It checks if the http GET was set if/else block.
It also checks if the $addrarray string was unserialized okay if block in the if/else.
Let me know if it looks right.
There is one thing I really need. If the geocoder doesn't work on
the google maps site. I get a javascript message then an ugly message in php.
see message below:
I need the try around the geocoder. Can you tell me how to do the catch?
It can just exit gracefully without the message. I don't want the message.
thanks,
<?php
require 'EasyGoogleMap.class.php';
//$googlemaps_api_key = "ABQIA.........";
if (isset ($GET['addr'])) {
$addr = $GET['addr'];
$addrstripped = stripslashes($addr);
$addrarray = @unserialize($addrstripped);
if ($addrarray == false) {
exit("There is a formatting error in the address list.");
}
} else {
exit("There is no value selected.");
}
try{
$gm = & new EasyGoogleMap($googlemaps_api_key);
throw exception("map could not be geocoded");
}
foreach( $addrarray as $key => $value){
$gm->SetAddress($value);
}
catch {
What goes here?
}
?>
ugly message.
Notice: Undefined variable: googlemaps_api_key in /Library/WebServer/Documents/googlemaparray3.php on line 21
ddListener(marker, 'click', function() { marker.openInfoWindowHtml(address_2.infowindowtext); }); map.addOverlay(marker); gmarkers[2] = marker; } else { map.setCenter(new GLatLng(37.4419, -122.1419), 8); } } ); // end geocoder.getLatLng var address_1 = { infowindowtext: '15272 Bolsa Chica St , Huntington Beach, Ca, 92649', full: '15272 Bolsa Chica St , Huntington Beach, Ca, 92649' }; address[1] = address_1.infowindowtext; geocoder.getLatLng ( address_1.full, function(point) { if(point) { points[1] = point; map.setCenter(point, 8); var marker = new GMarker(point, icon); GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(address_1.infowindowtext); }); map.addOverlay(marker); gmarkers[1] = marker; } else { map.setCenter(new GLatLng(37.4419, -122.1419), 8); } } ); // end geocoder.getLatLng var address_0 = { infowindowtext: '7069 Consolidated Way, Suite 100, San Diego, CA, 92121', full: '7069 Consolidated Way, Suite 100, San Diego, CA, 92121' }; address[0] = address_0.infowindowtext; geocoder.getLatLng ( address_0.full, function(point) { if(point) { points[0] = point; map.setCenter(point, 8); var marker = new GMarker(point, icon); GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(address_0.infowindowtext); }); map.addOverlay(marker); marker.openInfoWindowHtml(address_0.infowindowtext); gmarkers[0] = marker; } else { map.setCenter(new GLatLng(37.4419, -122.1419), 8); } } ); // end geocoder.getLatLng } // end if function sideClick(i) { if (gmarkers) { gmarkers.openInfoWindowHtml(address); map.setCenter(points,8); } else { var htstring = address; var stripped = htstring.replace(/(<([>]+)>)/ig,''); alert('Location not found: ' + stripped); } /endif/ } /end function / Web Viewer demo plotting an address list on Google Maps.
Technique uses Google Maps API Javascript framework, PHP, and Filemaker Pro. Served by Fi