When I try the following code, OpenLayers
returns a zero
result. What have I done wrong, here?
var map;
function loadMap () {
// Based on example code: view-source:
// http://openlayers.org/dev/examples/vector-formats.html
map = new OpenLayers.Map(el);
var googleStreetMap = new OpenLayers.Layer.Google('Google Street Map',
{ numZoomLevels: 20 });
map.addLayers(googleStreetMap);
var result = map.getNumLayers(); // Result == 0 :sad-panda:
}
In the code above, I thought that the map.getNumLayers()
should return 1
- considering i've asked to add a google street map.
Why is it returning zero, please?
UPDATE: something else to note: there is also no baseLayer :( I thought this would be the base layer???