[OpenLayers-Users] 2.6 Trunk Spherical Mercator with Overview Map

Linda Rawson linda.rawson at gmail.com
Wed Apr 9 22:34:42 EDT 2008

Ok.  Another thing I was really hoping for that I cannot get to work.
An overviewmap with sperical mercator.  I have last nights trunk.
What am I doing wrong?

        <title>Overview Map Example</title>
        <link rel="stylesheet" href="../theme/default/style.css"
type="text/css" />
	    <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
        <script src="../lib/OpenLayers.js" type="text/javascript"></script>
        #map {
            width: 512px;
            height: 512px;
            border: 1px solid gray;
    <script type="text/javascript">

        // make map available for easy debugging
        var map;

        // avoid pink tiles
        OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
        OpenLayers.Util.onImageLoadErrorColor = "transparent";

        function init(){
            var options = {
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("EPSG:4326"),
                units: "m",
                maxResolution: 156543.0339,
                maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
                                                 20037508, 20037508.34)
            map = new OpenLayers.Map('map', options);
            // create Google Mercator layers
            var gmap = new OpenLayers.Layer.Google(
                "Google Streets",
                {'sphericalMercator': true}
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            var overview1 = new OpenLayers.Control.OverviewMap();
            if (!map.getCenter()) {map.zoomToMaxExtent()}
    <body onload="init()">
        <h1 id="title">Overview Map</h1>
         <div id="map"></div>

I get the following errors:

Null is not an object

If I comment out the overview map I do not get any errors.

Linda Rawson

More information about the Users mailing list