[OpenLayers-Users] Problem Geoserver Layer

Luis Miguel Royo Perez luis.miguel.royo at gmail.com
Sat Mar 2 02:11:47 PST 2013


Hi everyone,

I'm new with openlayers, and i'm trying to create a new map with one 
layer served with Geoserver, but i'm getting some problems.

This is the code:

"//Definimos la variable map
var map;
function init() {
       //Opciones
       var options = {
                             projection: new 
OpenLayers.Projection("EPGS:900913"),
                             units: "m"

                          };

       //Creamos un nuevo objeto map en el div con el id = map
       map = new OpenLayers.Map('map',options);

          var mapnik = new OpenLayers.Layer.OSM();



         //Añadir capa Geoserver Pruebas
         var prueba =  new OpenLayers.Layer.WMS(
                     "Test:comarca - Tiled", 
"http://localhost:8080/geoserver/Test/wms",
                     {
                         LAYERS: 'Test:comarca',
                         format: 'img/png'
                     },
                     {
                         isBaseLayer: false,
                         yx : {'EPSG:900913' : false}
                     }
                 );


       // Añadir la capa al mapa
         map.addLayer(mapnik);

         map.addLayer(prueba);


         //Poner el centro del mapa en estas coordenadas.
         map.setCenter(new 
OpenLayers.LonLat(-412267.21675,4926706.34959),6);



         //Controles
         map.addControl(new OpenLayers.Control.LayerSwitcher());
         map.addControl (new OpenLayers.Control.MousePosition ());
         map.addControl(  new OpenLayers.Control.ScaleLine());
        }"

But Firebug show me this error:

TypeError: a is null
http://localhost/arqueoserver3/OpenLayers-2.12/OpenLayers.js
Line 467

What I'm doing wrong? Probably is something stupid, but i can't see it.

Thanks.

-- 
Luís Miguel Royo Pérez

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130302/cd8ef234/attachment.html>


More information about the Users mailing list