[OpenLayers-Users] Controls not working

G. Paolo Sanino V. research at leviathanchile.org
Tue Apr 1 20:04:09 EDT 2008


Hi All,

I am new at OpenLayers and I think this is awesome. I am trying to build a 
small GIS for an ONG using the same layers used on the Openlayers homepage. 
The big step will be to connect it to a database to store the markers. But in 
a later step.
I am so sorry to bother you with such a question. It may be very simple but I 
have had nightmares looking for a solution... Here is my problem:

I have gotten two layers working using "map.addlayer()" for each layer instead 
of using "map.addlayers()" for all. I do not know why, if I use "AddLayers", 
I only get a blank map (white) with only the blue buttons on the left up 
corner.
Also, and maybe related, I got the center and zoom of the map working, 
however, the next controls do not work/show in the map:
ScaleLine, MousePosition, OverviewMap.

Here is my code (from: http://www.cmmrleviathan.org/ciencia_GIS2.htm):

<script type="text/javascript">
var map, ol_wms, jpl_wms;
function init(){
map = new OpenLayers.Map('map', {'maxResolution': 1.40625/2});
jpl_wms = new OpenLayers.Layer.WMS( "Mapa 
Satelital","http://labs.metacarta.com/wms-c/Basic.py?", {layers: 'satellite', 
format: 'image/png' } );
map.addLayer(jpl_wms);
ol_wms = new OpenLayers.Layer.WMS( "Mapa 
Vectorial", "http://labs.metacarta.com/wms-c/Basic.py?", {layers: 'basic', 
format: 'image/png' } );
map.addLayer(ol_wms);
map.setCenter(new OpenLayers.LonLat(-79, -29), 2);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.ScaleLine());
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.OverviewMap());
}
</script>

any help or idea would be very much appreciated...

Best regards,
Gian Paolo



More information about the Users mailing list