views:

147

answers:

0

I have followed the instructions on the googlemaps website but I'm unable to get any maps to show (attempting example 1 and 2)

I did the following

Added jar to web-inf/lib, included it in my jsp using the taglib declaration (This should be correct since my IDE netbeans now recognises the tag and makes it bold when used)

I then added this into the HEAD

        <googlemaps:map id="map" width="250" height="300" version="2.44"
                        type="STREET" zoom="12" debug="on">
            <googlemaps:key domain="localhost:8080/salestracker" key="ABQIAAAAznZ9JIfmk4oBmB-S__ourhT_dIhMpR1Zj9UY8pK6KKBOlQbhRBQzPgfKEf1f2eTl97ZQB2GX8G_PjA"/>
            <googlemaps:point id="point1" address="74 Connors Lane"
                              city="Elkton" state="MD" zipcode="21921" country="US"/>
            <googlemaps:marker id="marker1" point="point1"/>
        </googlemaps:map>
        <googlemaps:javascript id="map"></googlemaps:javascript>
        <googlemaps:scripttag id="map"></googlemaps:scripttag>

The key should match the domain.

Then, somewhere in my page where I want to display the map, I have put in :

<googlemaps:div id="map"></googlemaps:div>

Also, right before the end of the body tag, I put

 <googlemaps:initialize id="map"></googlemaps:initialize>

I don't understand why it doesn't work. I have no errors on my application, just no map is shown.

If I view the source of my page, I can see the following in the header

<script type="text/javascript">
//<![CDATA[
var map;
var lastCenterLat;
var lastCenterLon;
var lastClick = new Date();
if(document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG","1.1")) {
    _mSvgEnabled = true;
    _mSvgForced = true;
}
function isDouble() {
    var now = new Date();
    var double_click = ((now.getTime() - lastClick.getTime()) < 500);
    lastClick = now;
    return double_click;
}
function setZoomLevels() {
    var mapTypes = map.getMapTypes();
    for (var i = 0; i < mapTypes.length; i++) {
        mapTypes[i].getMinimumResolution = function() {
            return 0;
        }
        mapTypes[i].getMaximumResolution = function() {
            return 17;
        }
    }
}
function initializeMapmap() {
    if (GBrowserIsCompatible()) {
        map = new GMap(document.getElementById("map"));
        map.setMapType(G_MAP_TYPE);
        setZoomLevels();
        map.centerAndZoom(new GPoint(-75.863697, 39.584933), 12);
        var marker1 = new GMarker(new GPoint(-75.863697, 39.584933));
        map.addOverlay(marker1);
        map.enableDragging();
    }
    lastCenterLat = 39.584933;
    lastCenterLon = -75.863697;
}
function drawCircle(lng, lat, radius, color, width, opacity) {
    var d2r = Math.PI/180;
    var r2d = 180/Math.PI; 
    var Clat = (radius/3963)*r2d;   
    var Clng = Clat/Math.cos(lat*d2r); 
    var Cpoints = []; 
    for (var i=0; i < 33; i++) { 
        var theta = Math.PI * (i/16); 
        Cx = lng + (Clng * Math.cos(theta)); 
        Cy = lat + (Clat * Math.sin(theta)); 
        var P = new GPoint(Cx,Cy);
        Cpoints.push(P); 
    }; 
    return new GPolyline(Cpoints, color, width, opacity);
}
//]]>
</script>

            <script src="http://maps.google.com/maps?file=api&amp;v=2.44&amp;key=ABQIAAAAznZ9JIfmk4oBmB-S__ourhT_dIhMpR1Zj9UY8pK6KKBOlQbhRBQzPgfKEf1f2eTl97ZQB2GX8G_PjA&amp;hl=en" type="text/javascript"></script>

Using stripes framework, glassfish v3 server