sehr genial! Danke dir!
wie müsste denn dann auch noch die admin/koordinatencheck.html abgeändert werden?
aktuell schaut die bei mir und auch bei bma2004 so aus:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Dieses Script ist von Erik Groennerud und wurde für die Gallery 4Images programmiert.
12.2007 - www.koelschwasser.de
Version 2.0-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps Koordinatensuche</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=GOOGLEKEY" type="text/javascript"></script>
<script type="text/javascript" src="/admin/scripts/jsr_class.js"></script>
<script type="text/javascript">
function objProperties(myObject){
var out = new Array();
for( property in myObject ) {
out.push(property + " = " + myObject[property]);
}
return out;
}
</script>
<script type="text/javascript">
//<![CDATA[
function load() {
xok=0;
yok=0;
zok=0;
if (GBrowserIsCompatible()) {
zoom=parseInt(opener.document.form.elements['image_gmap_zoom'].value);
if ((zoom < 21) && (zoom > 0))
{
zok = 1;
} else {
zoom = 3;
}
pointy = parseFloat(opener.document.form.elements['image_gmap_latitude'].value);
if ((pointy > -90) && (pointy < 90))
{
yok = 1;
} else {
pointy = 50;
}
pointx = parseFloat(opener.document.form.elements['image_gmap_longitude'].value);
if ((pointx > -180) && (pointx < 180))
{
xok = 1;
} else {
pointx = 9;
}
map = new GMap2(document.getElementById("map"));
map.addControl(new GOverviewMapControl());
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.enableScrollWheelZoom();
map.addMapType(G_PHYSICAL_MAP);
var copycycle1 = "© Cloudmade: ";
var copycycle2 = "<a href='http://www.cloudmade.com' target='_blank'>";
var cycle = [new GTileLayer()];
cycle[0].getTileUrl = function(a,b) {
return "http://tile.opencyclemap.org/cycle/" + b + "/" + a.x + "/" + a.y + ".png"; };
cycle[0].getCopyright = function(a,b) {
return {prefix:copycycle1, copyrightTexts:[copycycle2]}; }
G_CYCLE_MAP = new GMapType(cycle, G_SATELLITE_MAP.getProjection(), "Cycle-Map", {
shortName: "Cycle-Map", alt: "Cycle-Map von Cloudmade.com anzeigen",
minResolution:0,maxResolution:17});
map.addMapType(G_CYCLE_MAP);
map.setCenter(new GLatLng(pointy, pointx), zoom, G_PHYSICAL_MAP);
geocoder = new GClientGeocoder();
if ((xok==1) && (yok ==1) && (zok ==1)) {
marker = new GMarker(map.getCenter());
map.addOverlay(marker);
marker.openInfoWindowHtml("<b>Latitude:</b> " + pointy + "<br />" + "Longitude: " + pointx+ "<br />" + "Zoomlevel: " + map.getZoom());
document.getElementById('latitude').value = pointy;
document.getElementById('longitude').value = pointx;
document.getElementById('zoom').value = zoom;
request = 'http://ws.geonames.org/findNearbyPostalCodesJSON?lat=' + pointy + '&lng=' + pointx + '&callback=getLocation';
// Create a new script object
aObj = new JSONscriptRequest(request);
// Build the script tag
aObj.buildScriptTag();
// Execute (add) the script tag
aObj.addScriptTag();
}
GEvent.addListener(map, 'click', function(event) {
if (point){
document.getElementById('latitude').value = event.latLng.lat();
document.getElementById('longitude').value = event.latLng.lon();
document.getElementById('zoom').value = map.getZoom();
}
if (marker) {
map.removeOverlay(marker);
} else {
map.clearOverlays();
marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml("<b>Latitude:</b> " + point.y + "<br />" + "Longitude: " + point.x+ "<br />" + "Zoomlevel: " + map.getZoom());
}
if (point){
request = 'http://ws.geonames.org/findNearbyPostalCodesJSON?lat=' + point.y + '&lng=' + point.x + '&callback=getLocation';
// Create a new script object
aObj = new JSONscriptRequest(request);
// Build the script tag
aObj.buildScriptTag();
// Execute (add) the script tag
aObj.addScriptTag();
}
}
);
}
}
function addAddressToMap(response) {
map.clearOverlays();
if (!response || response.Status.code != 200) {
alert("Sorry, konnte leider Adresse nicht finden!");
} else {
place = response.Placemark[0];
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml("<b>Latitude:</b> " + point.y + "<br />" + "Longitude: " + point.x+ "<br />" + "Zoomlevel: " + map.getZoom());
document.getElementById('latitude').value = event.latLng.lat();
document.getElementById('longitude').value = event.latLng.lon();
document.getElementById('zoom').value = map.getZoom();
}}
function showLocation() {
var address = document.forms[0].q.value;
geocoder.getLocations(address, addAddressToMap);
}
function getLocation(jData) {
if (jData == null) {
// There was a problem parsing search results
return;
}
var html = '';
var postalCodes = jData.postalCodes;
var name = postalCodes[0];
// we create a simple html list with the geonames objects
// the link will call the center() javascript method with lat/lng as parameter
html = html + '<a href="javascript:center(' + name.lat +',' + name.lng + ');">' + name.placeName + '</a><br>';
var point = new GLatLng(parseFloat(name.lat), parseFloat(name.lng));
var address = name.placeName + ", "+ name.countryCode;
// Adresse in Suchfeld eintragen
document.forms[0].q.value = address;
map.addOverlay(marker);
marker.openInfoWindowHtml("<b>Latitude:</b> " + pointy + "<br />" + "Longitude: " + pointx+ "<br />" + "Zoomlevel: " + map.getZoom());
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowTabsHtml(infoTabs);
}
function OK() {
opener.document.form.elements['image_keywords'].value = opener.document.form.elements['image_keywords'].value + " " + document.forms[0].q.value;
opener.document.form.elements['image_gmap_latitude'].value= document.forms[0].latitude.value;
opener.document.form.elements['image_gmap_longitude'].value=document.forms[0].longitude.value;
opener.document.form.elements['image_gmap_zoom'].value = document.forms[0].zoom.value;
opener.document.form.elements['image_gmap_type'].value = "3";
opener.document.form.elements['image_gmap_show'][0].checked = true;
self.close();
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<center>
<form action="#" onsubmit="showLocation(); return false;">
<b>Adresse eingeben oder klicke in Karte:</b><br>
<input type="text" name="q" value="" class="address_input" size="40" />
<input type="submit" name="find" value="Search" />
<div id="map" style="width: 500px; height: 500px"></div>
<div>
Breitengrad: <input name="latitude" id="latitude" type="text" />
Zoom: <input name="zoom" id="zoom" type="text" size="2"/>
Laengengrad: <input name="longitude" id="longitude" type="text" />
</div>
</form>
<script type="text/javascript" language="JavaScript">
<!--
if (window.opener)
document.write('<input type="button" name="OK" value="OK" onclick="OK();">');
document.write('<input type="Button" name="Abbrechen" value="Abbrechen" onclick="self.close();">');
//-->
</script>
</center>
</body>
</html>