[TYPO3-german] Google Parameter

Uwe Jakobs uwe.jakobs at imageco.de
Mon Jan 14 14:23:46 CET 2008


Hallo Ulrike,

Du brauchst keine Experimente mit einer lokalen DB (z.b. GeoDB)
durchzuführen, um ans gewünschte Ziel zu gelangen. Denke an Entwicklungszeit
und Serverlast und nutze einfach die GoogleMaps-API:


#####################################################
### Diesen Teil im Typo3-Seitentemplate einfügen: ###
#####################################################


page.bodyTag = <body onload="load()" onunload="GUnload()">


###################################################
### Diesen Teil als HTML-Seitenelement einfügen: ##
###################################################

<script src="http://maps.google.com/maps?file=api&v=2&key=DEIN_KEY"
  type="text/javascript"></script>
<script type="text/javascript">

//<![CDATA[

var geocoder;
var map;

var location = "DEINE_LOCATION";
var address = "STRASSE+HAUSNUMMER+PLZ+STADT";

// On page load, call this function

function load()
{
  // Create new map object
  map = new GMap2(document.getElementById("map"));

  // Create new geocoding object
  geocoder = new GClientGeocoder();

  // Retrieve location information, pass it to addToMap()
  geocoder.getLocations(address, addToMap);
}

// This function adds the point to the map

function addToMap(response)
{
  // Retrieve the object
  place = response.Placemark[0];

  // Retrieve the latitude and longitude
  point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);

  // Center the map on this point
  map.setCenter(point, 13);

  // Create a marker
  marker = new GMarker(point);

  // Add the marker to map
  map.addOverlay(marker);
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());

  // Add address information to marker
  marker.openInfoWindowHtml(location +'<br />' + place.address);
}

//]]>
</script>
<div id="map" style="width: 100%; height: 500px"></div>

###################################################
####                 ENDE                       ###
###################################################

Aus diesem (statischen) Javascript kannst Du ablesen, welche Parameter Du
setzten musst, um auch aus einer Extension heraus Deine Locationsuche
automatisieren zu können - von echtem AJAX würde ich dann aber auch noch
nicht reden ;) - : Einfach die Variable "address" nach bestehender Vorgabe
(die Pluszeichen sind wichtig) füllen lassen und dann das Javascript als
$content ausgeben lassen. Fertig!

Hoffe, Dir einigermaßen geholfen zu haben,

Viele Grüße

Uwe Jakobs
ImageCode



-----Ursprüngliche Nachricht-----
Von: Ulrike Bätz [mailto:ubaetz at ubaetz.net] 
Gesendet: Montag, 14. Januar 2008 12:06
An: 'German Typo3 Userlist'
Betreff: [TYPO3-german] Google Parameter

Hallo Liste,

 

Weiss jemand aus welchen Parametern sich

Lon und lat für die Googlemap

Errechnet?

 

Plz

Ort

Strasse

Nummer

??

Oder nur ein Teil davon

Oder fehlt was?

 

Ulrike Bätz

 





More information about the TYPO3-german mailing list