Zamples, Inc. logo
 Home   Search   Solutions   My Zamples   FAQ   News   Contact 
Zamples ID:
Password:
   
0 anonymous users;
40 users logged in.

Live Samples
Live APIs

HTML or JSP Frag
Java Servlet Frag
HTML & Applet
Bash
C# (Mono)
C++ (gcc)
Groovy
Haskell (Hugs98)
J2SE 1.4 Class
J2SE 1.4 Fragment
J2SE 5.0 Class
J2SE 5.0 Fragment
J2SE 6.0 Class
J2SE 6.0 Fragment
Perl
Python
Ruby
 
Google Maps API

The Google Maps API is quite interesting.  Google won't provide a map unless a unique key is provided for each URL that requests the map, which includes the complete domain/subdomain/subdirectory and port of the web server that displays the page - and the URL is case sensitive.  This means that our key will not work on your server.

Basic Map

Here is a code fragment for a simple search.  We have pasted in our Google Maps key for you:

<script 
src="http://maps.google.com/maps?file=api&v=1&key=ABQI...twwQ"
type="text/javascript"></script>
<div id="map" style="width: 500px; height: 400px"></div>
<script type="text/javascript">
//<![CDATA[
    
var map = new GMap(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4);
    
//]]>
</script>

Output

Satellite/Map Control Buttons

<script 
src="http://maps.google.com/maps?file=api&v=1&key=ABQI...twwQ"
type="text/javascript"></script>
<div id="map" style="width: 500px; height: 400px"></div>
<script type="text/javascript">
//<![CDATA[
    
var map = new GMap(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4);
    
//]]>
</script>

Output

After clicking on the satellite button, you should see: