[OpenLayers-Users] Problem Geoserver Layer

Gery . gamejihou at hotmail.com
Sat Mar 2 02:38:11 PST 2013


Hola Luis,

I work with mapserver instead of geoserver, so not sure if yz can be the problem. I think you have to test first getting the map without layers, since you're working only with 900913, just plot the OSM baselayer first in OL, if that works then put things above, ie. your geoserver layers.

Salu2,

Gery 


__________________________________________________________________________________________
Piensa en el medio ambiente - mantenlo en la pantalla. NO lo imprimas si NO es necesario.
Think green - keep it on the screen. Do NOT print if it is NOT necessary.
Denken Sie an die Umwelt - bewahren Sie es auf dem Bildschirm. Drucken Sie es NICHT, wenn es NICHT notwendig ist.


Date: Sat, 2 Mar 2013 11:11:47 +0100
From: luis.miguel.royo at gmail.com
To: openlayers-users at lists.osgeo.org
Subject: [OpenLayers-Users] Problem Geoserver Layer


  

    
  
  
    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

  


_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130302/47cb8b9a/attachment.html>


More information about the Users mailing list