This example can be added to any web page on any server without any other changes, or software. (In other words, this is all that is required.)
Note: First, you will need to replace the key=xxxxxxxxxxx...xxxxxxxxxxxxxxx with the correct key for your web site. You can get a key for free here:
http://code.google.com/apis/maps/signup.html
Now, you can either view and copy the source of the page at http://www.geobytes.com/MashupGeoDirect ... leMap.html and use it as the bases of your own new page. (remember to change the key or it won't work) or you can add the following to an existing page.
To add to an existing page:
1. Add this line where you want the map to display:
- Code: Select all
<div id="map" style="width: 700px; height: 400px"></div>
and
2. Add this block of code to the header section of your page:
- Code: Select all
<script language="Javascript" src="http://gd.geobytes.com/gd?after=-1&variables=GeobytesCountry,GeobytesCity,GeobytesRegion,GeobytesLatitude,GeobytesLongitude">
</script>
<script src="http://maps.google.com/maps?file=api&v=2&key=xxxxxxxxxxx...xxxxxxxxxxxxxxx" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load()
{
if (GBrowserIsCompatible())
{
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.enableContinuousZoom();
map.setCenter(new GLatLng(sGeobytesLatitude, sGeobytesLongitude), 11);
}
}
function GUnload()
{
if (window.GUnloadApi)
{
GUnloadApi();
}
}
//]]>
</script>
3. Add these parameters to the <body tag of your page:
- Code: Select all
<body onload="load()" onunload="GUnload()">
4. Finally, if you don't want any pop-up ads then you will need some Mapbytes. ($50 will give you 50,000 accesses)
Please let us know how you go, I would love to see it, and in any case please let me know if I can assist further.