[Seaside] Google Maps API Services Geocoding
Dario Trussardi
dtrussardi at tiscali.it
Wed Feb 11 21:18:49 UTC 2009
Hi Steve,
about your e-mail:
* I'm also interested in using the Google maps API from Seaside. I am far from
* an expert but it's possible to use an HttpRequest object to do this from the
* server.
I solve it with: HTTPSocket httpGet: url
* My question is why would you do it from the server when you could make the
* request directly from the user's browser using the JavaScript API?
My input from user's browser , based on Magritte, is a string.
I'm not a javascript expert and i d'ont know how integrate it with seaside field.
In the Google documentation i found this javascript but how integrate it with my input data ?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps API Example: Simple Geocoding</title>
<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA" type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var geocoder = null;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<form action="#" onsubmit="showAddress(this.address.value); return false">
<p>
<input type="text" size="60" name="address" value="1600 Amphitheatre Pky, Mountain View, CA" />
<input type="submit" value="Go!" />
</p>
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</form>
</body>
</html>
* I'm also wondering why you chose the static API instead of the dynamic one.
* I haven't played with the static version and I'm curious about its
* advantages.
When i accept the user's browser i call the API for define the 'location' and after i browser a map for controll.
Ciao,
Dario
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20090211/9ae1259d/attachment.htm
More information about the seaside
mailing list