[OpenLayers-Users] Controls not working

Frédéric Junod frederic.junod at camptocamp.com
Wed Apr 2 02:47:56 EDT 2008


Hi,

You can't use the ScaleLine control because you're using and old version of
OpenLayers (http://www.openlayers.org/api/OpenLayers.js version 2.5). The
ScaleLine control was added after the 2.5 release.

You have to use a more recent version of OpenLayers, the new stable release is
not ready yet but you can use the release candidate:
http://openlayers.org/api/2.6-rc1/OpenLayers.js
But this is not the final code !! When the final 2.6 will be released this url
will become obsolete ... 

fredj


Le Tue, 1 Apr 2008 20:04:09 -0400,
"G. Paolo Sanino V." <research at leviathanchile.org> a écrit :

> 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
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users


-- 
Frédéric Junod
Camptocamp SA



More information about the Users mailing list