[OpenLayers-Users] Layer not shown

Toni Ramiro anrapas at gmail.com
Fri Nov 13 06:05:45 EST 2009


Ok. I've modified the code this way (the red one):

            var opciones = {
                    projection:"EPSG:4230",
                    units:"dd",
                    maxExtent:new OpenLayers.Bounds(-3,37,0,39)
                };
            map = new OpenLayers.Map('map', opciones);

            var sigpac_layer = new OpenLayers.Layer.WMS(
                "PNOA",
                "http://www.idee.es/wms/PNOA/PNOA",
                {
                    layers:"pnoa",
                    version:"1.1.1",
                    format:"image/png"
                },
                {
                    projection:"EPSG:4230"
                });
            map.addLayer(sigpac_layer);

            var mapserver_layer = new OpenLayers.Layer.WMS(
                'Murcia',
                'http://localhost/cgi-bin/mapserv.exe',
                {

 map:'D:/Desarrollo/MapServer/datos/ms_murcia_qgis_shp.map',

 layers:'arquetas_otros_planifrega,regulacion_ext_planifrega,conducciones_planifrega,regulacion_int_planifrega,tomas_planifrega,balsas_planifrega,bombeos_planifrega'
                    transparent:'true'
                },
                {
                    projection:"EPSG:4326",
                    units:"m",
                    maxExtent:new
OpenLayers.Bounds(548757,4138136,716640,4282922)
                });
            map.addLayer(mapserver_layer);

            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.addControl(new OpenLayers.Control.MouseToolbar());
            map.addControl(new OpenLayers.Control.MousePosition());
            map.zoomToMaxExtent();


But I've recived the same result.

Thanks.



2009/11/12 Alexandre Dube <adube at mapgears.com>

> Hi Toni,
>
>  Your data projection is in meters, so you must set it in the
> OpenLayers.Map object as well.  By default, it's in degrees [1].  Plus, the
> maxExtent should be in meters too (try using the one from your mapfile).
>
>  If it's still not working, you can try watching the request built from
> OpenLayers in Firebug and see the response.  There may more more clues
> there.
>
>  Best of luck,
>
> Alexandre
>
> [1]
> http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.units
>
> Toni Ramiro wrote:
>
>> I'm new to this and I've encountered a problem.
>>
>> I defined the following code to load one layer with OpenLayers
>>
>>            var opciones = {
>>                    projection:"EPSG:4230",
>>                    maxExtent:new OpenLayers.Bounds(-3,37,0,39)
>>                };
>>            map = new OpenLayers.Map('map', opciones);
>>            var sigpac_layer = new OpenLayers.Layer.WMS(
>>                "PNOA",                "http://www.idee.es/wms/PNOA/PNOA",
>>                {
>>                    layers:"pnoa",                    version:"1.1.1",
>>                    format:"image/png"
>>                },                {
>>                    projection:"EPSG:4230",
>>                    units:"m"
>>                });
>>            map.addLayer(sigpac_layer);
>>
>>            var mapserver_layer = new OpenLayers.Layer.WMS(
>>                'Murcia',
>>                'http://localhost/cgi-bin/mapserv.exe',
>>                {
>>
>>  map:'D:/Desarrollo/MapServer/datos/ms_murcia_qgis_shp.map',
>>                    layers:'arquetas_otros_planifrega',
>>                    transparent:'true'
>>                },                {
>>                    projection:"EPSG:4326",
>>                    units:"m"
>>                });
>>            map.addLayer(mapserver_layer);
>>
>>            map.addControl(new OpenLayers.Control.LayerSwitcher());
>>            map.addControl(new OpenLayers.Control.MouseToolbar());
>>            map.addControl(new OpenLayers.Control.MousePosition());
>>            map.zoomToMaxExtent();
>>
>> My MapServer project  is as follows:
>>
>> MAP
>>  NAME Murcia
>>  SIZE 800 600
>>  UNITS METERS
>>
>>  EXTENT 544061.905938 4135608.106250 720849.906562 4288074.143750
>>    CONFIG PROJ_LIB "D:\Desarrollo\MapServer\proj\nad\"
>>    PROJECTION
>>    'proj=longlat'
>>    'ellps=WGS84'
>>    'datum=WGS84'
>>    'no_defs'
>>    ''
>>  END
>>
>>  IMAGECOLOR 192 192 192
>>  IMAGEQUALITY 95
>>  IMAGETYPE png
>>  OUTPUTFORMAT
>>    NAME png
>>    DRIVER 'GD/PNG'
>>    MIMETYPE 'image/png'
>>    EXTENSION 'png'
>>  END
>>
>>  LEGEND
>>      IMAGECOLOR 255 255 255
>>    STATUS ON
>>    KEYSIZE 18 12
>>    LABEL
>>      TYPE BITMAP
>>      SIZE MEDIUM
>>      COLOR 0 0 89
>>    END
>>  END
>>
>>  WEB
>>    IMAGEPATH 'C:/Inetpub/tmp/'
>>    IMAGEURL '/tmp/'
>>
>>    METADATA
>>      'wms_title'           'Murcia'
>>      'wms_onlineresource'  '
>> http://localhost/cgi-bin/mapserv.exe?map=D:/Desarrollo/MapServer/datos/ms_murcia_qgis_shp.map&<
>> http://localhost/cgi-bin/mapserv.exe?map=D:/Desarrollo/MapServer/datos/ms_murcia_qgis_shp.map&
>> >'
>>
>>      'wms_srs'             'EPSG:4326'
>>    END
>>
>>  END
>>  LAYER
>>    NAME 'arquetas_otros_planifrega'
>>    TYPE POINT
>>    DATA
>> 'D:\Desarrollo\MapServer\datos\CapasDePrueba\arquetas_otros_planifrega.shp'
>>    METADATA
>>      'wms_title' 'arquetas_otros_planifrega'
>>    END
>>    STATUS DEFAULT
>>    TRANSPARENCY 100
>>    PROJECTION
>>    'proj=longlat'
>>    'ellps=WGS84'
>>    'datum=WGS84'
>>    'no_defs'
>>    ''
>>    END
>>    CLASS
>>       NAME 'arquetas_otros_planifrega'       STYLE
>>         SYMBOL 'CIRCLE'         SIZE 2         OUTLINECOLOR 0 0 0
>>         COLOR 31 2 3
>>       END
>>    END
>>  END
>>
>>      SYMBOL
>>        NAME 'CIRCLE'
>>        TYPE ellipse
>>        FILLED true
>>        POINTS
>>          1 1
>>        END
>>      END END
>>
>> The result is that the OpenLayers 'Murcia' layer shows no data, and if
>> left alone in the project only shows a gray background.
>>
>> I've tried the same using QGis WMS client to Mapserver and shows the data.
>>
>> żDo anybody knows how to solve the problem?
>>
>> Thanks a lot.
>>
>> --
>> Saludos,
>>   Toni Ramiro
>>   <anrapas at gmail.com <mailto:anrapas at gmail.com>>
>>   <aramiro151r at cv.gva.es <mailto:aramiro151r at cv.gva.es>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
>
> --
> Alexandre Dubé
> Mapgears
> www.mapgears.com
>
>


-- 
Saludos,
   Toni Ramiro
   <anrapas at gmail.com>
   <aramiro151r at cv.gva.es>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091113/5496f2de/attachment.html


More information about the Users mailing list