[OpenLayers-Users] Local Geoserve WMS not working

Hugo hfpmartins at gmail.com
Mon Feb 16 07:58:48 EST 2009


Hello all,

I've beenmaking some experiences with openlayers and mapfish. I have postgis
database and geoserver up and running. My problem is with wms created in my
geoserver. I can load this wms in any thick client (qgis, gvsig) and if i
choose the mappreview of the geoserver admin page it is also running ok (in
the openlayers).

If i now try to make my own script it doesn´t shows anything. Any hint on
what may be happening??
This is my very simple code. It is calling openlayers from mapfish (which i
tried first with google layers and works fine):

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>OpenLayers</title>
    <script type="text/javascript"
src="../client/mfbase/openlayers/lib/Firebug/firebug.js"></script>
    <script src="
http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAqjXqK2AnPc3L2h71jEi4pxS89dNBXjbs3KhxedIObIPgZlGU8RSY0Afhq8cq5fuNgI-GZP2m_MM0Pw"
type="text/javascript"></script>
    <script type="text/javascript"
src="../../client/mfbase/openlayers/lib/OpenLayers.js"></script>
    <style>
        #panel {
            right: 0px;
            height: 30px;
            width: 200px;
        }
        #panel div {
            float: left;
            margin: 5px;
        }
    </style>
    <script type="text/javascript">

    function init(){

        var bounds = new OpenLayers.Bounds (-133259.566796875,
-329230.621875, 176201.293359375, 304911.746875);

        var options = {
            maxExtent: bounds,
            maxResolution: 2477.1186279296876,
            projection: "EPSG:27492",
            units: 'm'
        }

        map = new OpenLayers.Map('center');

        var caop =  new OpenLayers.Layer.WMS (
            "CAOP",
            "http://localhost:8080/geoserver/wms?",
            {
                layers: 'pg:caop',
                srs: 'EPSG:27492',
                styles: '',
                format: 'image/png'
            },
            {isBaseLayer: true}
        );

        map.addLayers([caop]);
        map.addControl(new OpenLayers.Control.LayerSwitcher());
        map.zoomToMaxExtent();
    };

    </script>
    </head>
  <body onload="init()">
    <div id="center" style="width: 700px; height: 550px"></div>
  </body>
</html>


Thanks in advance,

Hugo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090216/ee3993cd/attachment.html


More information about the Users mailing list