<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000099" bgcolor="#ffffff">
    <font size="-1"><font face="Verdana">If you're using addLayers(),
        you must pass it an array of layers, not a layer itself, and not
        each layer in its own parameter.<br>
        <br>
        So, instead of "map.addLayers(mapnik, markers);" try
        "map.addLayers([mapnik, markers]);".<br>
        <br>
        Also, you're adding the same layer several times there.<br>
        <br>
        Janis<br>
        <br>
      </font></font><br>
    On 2011.06.02. 18:01, Nicholas Efremov-Kendall wrote:
    <blockquote
      cite="mid:BANLkTimZnMUbGPtXb+czcjXHnW-h3G87=A@mail.gmail.com"
      type="cite">
      <div>Hi all,</div>
      <div><br>
      </div>
      <div>I'm sure there's a something elementary that I'm missing
        here, but I can't seem to figure this out...</div>
      <div><br>
      </div>
      <div>I'm trying to set up a simple map centered on specific lon
        lat. The error provided by chrome is that it can't call method
        'containslatlon' of null. I'm not sure what I'm doing wrong
        here, but the script gives me the map and control, but no
        layers. thanks in advance.</div>
      <div><br>
      </div>
      <div>&lt;!DOCTYPE html &gt;</div>
      <div>&lt;html&gt;</div>
      <div>&lt;head&gt;</div>
      <div>&lt;meta http-equiv="Content-Type" content="text/html; /&gt;</div>
      <div>&lt;style&gt;</div>
      <div>#map{</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>width:
        400px;</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>height:
        400px;</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
      <div>&lt;/style&gt;</div>
      <div><br>
      </div>
      <div>&lt;script type="text/javascript" src="<a
          moz-do-not-send="true"
          href="http://maps.google.com/maps/api/js?sensor=true">http://maps.google.com/maps/api/js?sensor=true</a>"&gt;&lt;/script&gt;</div>
      <div>&lt;script src="OpenLayers-2.11-rc1/OpenLayers.js"
        type="text/javascript"&gt;&lt;/script&gt;</div>
      <div>&lt;script src="modernizr-1.7.min.js"
        type="text/javascript"&gt;&lt;/script&gt;</div>
      <div>&lt;script src="<a moz-do-not-send="true"
          href="http://www.openstreetmap.org/openlayers/OpenStreetMap.js">http://www.openstreetmap.org/openlayers/OpenStreetMap.js</a>"&gt;&lt;/script&gt;</div>
      <div> &lt;script type="text/javascript"&gt;</div>
      <div>        // &lt;![CDATA[</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>function
        initGIS(){</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>//Map</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>var
        map= new OpenLayers.Map('map',</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>controls:[</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>new
        OpenLayers.Control.Navigation(),</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>new
        OpenLayers.Control.PanZoomBar(),</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>new
        OpenLayers.Control.LayerSwitcher(),</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>new
        OpenLayers.Control.Attribution(),</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>new
        OpenLayers.Control.ScaleLine()],</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>sphericalMercator:
        true,</div>
      <div>  <span class="Apple-tab-span" style="white-space: pre;"> </span>maxExtent:
        new
        OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),</div>
      <div>  <span class="Apple-tab-span" style="white-space: pre;"> </span>maxResolution:
        156543.0399,</div>
      <div>  <span class="Apple-tab-span" style="white-space: pre;"> </span>numZoomLevels:
        19,</div>
      <div>  <span class="Apple-tab-span" style="white-space: pre;"> </span>units:
        'm',</div>
      <div>//  <span class="Apple-tab-span" style="white-space: pre;"> </span>projection:
        new OpenLayers.Projection("EPSG:900913"),</div>
      <div>//  <span class="Apple-tab-span" style="white-space: pre;"> </span>displayProjection:
        new OpenLayers.Projection("EPSG:4326")</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>);</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>//Google
        BaseLayer<span class="Apple-tab-span" style="white-space: pre;">
        </span></div>
      <div>var mapnik = new OpenLayers.Layer.OSM();</div>
      <div>        map.addLayers(mapnik);</div>
      <div>//<span class="Apple-tab-span" style="white-space: pre;"> </span>var
        google_map = new OpenLayers.Layer.Google('Google Maps',{});</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>
           var markers=new OpenLayers.Layer.Markers("Markers");</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>map.addLayers(mapnik,
        markers);</div>
      <div><br>
      </div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>map.setCenter(</div>
      <div>    <span class="Apple-tab-span" style="white-space: pre;">
        </span>new OpenLayers.LonLat(38.65, -90.72).transform(new
        OpenLayers.Projection("EPSG:4326"),new
        OpenLayers.Projection("EPSG:900913")</div>
      <div>    <span class="Apple-tab-span" style="white-space: pre;">
        </span>), 12</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>);</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
      <div><span class="Apple-tab-span" style="white-space: pre;"> </span>//]]&gt;</div>
      <div>&lt;/script&gt;</div>
      <div>&lt;/head&gt;</div>
      <div>&lt;body onLoad="initGIS()"&gt;</div>
      <div>&lt;div id="map"&gt;&lt;/div&gt;</div>
      <div>&lt;/body&gt;</div>
      <div>&lt;/html&gt;</div>
      <div><br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
    </blockquote>
  </body>
</html>