[OpenLayers-Users] add a mapserver

Francesco Geri francescogeri at yahoo.it
Mon Jul 30 08:31:13 PDT 2012


Hello,
I'm trying to build a webgis application based on geoext and mapserver. With the wfs layer I have no problem, but I unable to visualize a WMS layer through the use of Mapserver. When I try a getMap request the map is displayed correctly. I can't understand where is the problem because with geoserver I never had problems.

This is an extract of my code:

  ....       
        var ctrwms = new OpenLayers.Layer.WMS("CTR",
          "http://localhost/cgi-bin/mapserv?map=/var/www/web/workspace/provawms/wms.map",
                {
                    'layers': 'ctr1',
                    transparent: true,
                    format: 'image/png',
                },
                {
                    isBaseLayer: false,
                    unsupportedBrowsers: []
                }
            );

.....

    mapPanel = new GeoExt.MapPanel({
        border: true,
        region: "center",
        // we do not want all overlays, to try the OverlayLayerContainer
        map: map,
        center: new OpenLayers.LonLat(1401837, 5184672),
        zoom: 12,
        tbar: [toolbarItems,zoomSelector],
        layers: [
            mapnik,
            layer1,
            layer2,
            ctrwms
      
        ]
    });

.....


and this is my wms mapfile


MAP
  NAME "WMS_server"
  STATUS ON
  SIZE 600 500
  ##SYMBOLSET "../etc/symbols.txt"
  EXTENT 1395920.955 5186948.808 1400773.272 5190970.799
  UNITS METERS
  IMAGECOLOR 0 0 255
  IMAGETYPE image/png
  ##FONTSET "../etc/fonts.txt"

  WEB
    IMAGEPATH "/tmp/"
    IMAGEURL "/tmp/"
    METADATA
      "wms_title"          "WMS Demo Server for MapServer" ## REQUIRED
      "wms_onlineresource" "http://demo.mapserver.org/cgi-bin/wms?" ## Recommended
      
            );"wms_srs"            "epsg:900913" ## Recommended
      "wms_abstract"       "This text describes my WMS service." ## Recommended
      "wms_enable_request" "*"  # necessary
    END
    TEMPLATE 'prova_t.html'
    HEADER 'prova_t_header.html'
  FOOTER 'prova_t_footer.html'
  END

  PROJECTION
    "init=epsg:900913"
  END


OUTPUTFORMAT   ### 24 bit PNG
  NAME 'agg_png'
  DRIVER AGG/PNG
  IMAGEMODE RGB
END

  
  LAYER
    NAME "ctr1"
      STATUS ON
    METADATA
      "wms_title"         "ctr1" ##REQUIRED
      "wms_srs"           "epsg:900913" ## REQUIRED
      "wms_onlineresource" "http://localhost/cgi-bin/mapserv?map=/var/www/web/workspace/provawms/wms.map" 
      "wms_enable_request" "*"
    END
   TYPE RASTER
   DATA 'data/gggg.tif'
    PROJECTION
      "init=epsg:900913"
    END
  END #layer
END #mapfile


Thanks to everybody

Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120730/078a230d/attachment-0001.html>


More information about the Users mailing list