[mapserver-users] WMS client sample

Evemar Wernick evemar at paranacidade.org.br
Wed Jul 22 15:30:55 EDT 2009


Hi all,

I'm trying to show a WMS layer in Mapserver (5.4.1). I've tried to use 
lots of samples from the Internet, but without success.
It woks fine with some local data (shapefiles), so it's not a 
Mapserver/Apache problem (I'm using MS4W). I also have tested the 
connection url in ArcGis, and was ok.
When I try to get WMS layer, it just show a blank rectangle...
Does anyone could help or send me some working sample (html and .map)?

Below is my last tried.

Thanks,
Evemar

**** index.html (start)****
<html>
    <head><title>Mapserver WMS</title></head>
<body>
    <h4>Formulário de inicialização</h4>
    <form name="frm" method="get" action="/cgi-bin/mapserv.exe" >
        <input type="hidden" name="program" value="/cgi-bin/mapserv.exe" 
 ><br>
        MapFile: <input type="text" name="map" 
value="../htdocs/wms_test2.map" size="90">
        <input type="submit" value="start">
    </form>
</body>
</html>
**** index.html (end)****

**** web_template.html (start)****
<!-- MapServer Template -->
<html>
    <head><title>Mapserver</title></head>
<body>
    <h4>Executando consultas</h4>
    <form name="frm" method="get" action="/cgi-bin/mapserv.exe">
        <input type="image" name="ref" src="[ref]" border="0">
<br>
        <input type="hidden" name="program" value="[program]">
        <input type="hidden" name="map"     value="[map]">
        <input type="hidden" name="imgext" value="[mapext]">
        <input type="hidden" name="imgxy" value="[center]">
        <input type="hidden" name="zoomsize" value="2">
        <input type="image" name="img" src="[img]" border="1">
        <br>
        <img src="[legend]" alt="Legenda">
    <br>
        <img src="[scalebar]" alt="Scalebar">
    <br>
        <input type="radio" name="zoomdir" value="1" checked 
[zoomdir_1_check]>Aproximar
        <input type="radio" name="zoomdir" value="0"  
[zoomdir_0_check]>Mover
        <input type="radio" name="zoomdir" value="-1" 
[zoomdir_-1_check]>Afastar
        <input type="submit" value="Atualizar">
    </form>
</body>
</html>
**** web_template.html (end)****

**** wms_test2.map (start)****
MAP
  NAME TEST
  STATUS ON
  SIZE 900 500
  EXTENT -180 -90 180 90
  UNITS DD
  IMAGETYPE PNG24
  OUTPUTFORMAT
    NAME png24
    DRIVER "GDAL/PNG"
    MIMETYPE "image/png"
    IMAGEMODE RGB
    EXTENSION "png"
  END
  SHAPEPATH "/shp/"
#  FONTSET "/tmp/font/fontset"

#  projection
#    "init=EPSG:4326"
#  end

  SCALEBAR
    STATUS EMBED
    UNITS KILOMETERS
    INTERVALS 3
    TRANSPARENT TRUE
    OUTLINECOLOR 0 0 0
  END #End of SCALEBAR

  WEB
    TEMPLATE web_template.html
    MAXSCALE 125992916
#    IMAGEPATH "/tmp/"
#    IMAGEURL "/tmp/"
    IMAGEPATH "/ms4w/tmp/ms_tmp/"
    IMAGEURL "/ms_tmp/"
    LOG "/tmp/mapserver.log"
  END #End of WEB

layer
  name "da"
  type raster
  offsite 0 0 0
  status DEFAULT
  connectiontype wms
  connection "http://wms.jpl.nasa.gov/wms.cgi?"
  metadata
    "wms_title" "global"
    "wms_srs" "EPSG:4326"
    "wms_name" "global_mosaic"
    "wms_style" "visual"
    "wms_server_version" "1.1.1"
    "wms_format" "image/jpeg"
    "wms_force_separate_request" "1"
  end
  projection
    "init=EPSG:4326"
  end
end

 LAYER
  NAME "prov_bound"   # province
  TYPE RASTER
  STATUS default
  CONNECTION "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?"
  CONNECTIONTYPE WMS
  METADATA
    "wms_srs"             "EPSG:42304"
    "wms_name"            "prov_bound"
    "wms_server_version"  "1.1.1"
    "wms_format"          "image/gif"
  END
END

END #End of MAP
**** wms_test2.map (end)****


**** MapServer WMS support check ****
C:\ms4w\Apache\cgi-bin>mapserv -v
MapServer version 5.4.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP 
OUTPUT=PDF
 OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE 
SUPPORTS=ICO
NV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT 
SUPPORTS=WFS_SERVER
SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER 
SUPPORTS=FASTCGI SUP
PORTS=THREADS SUPPORTS=GEOS SUPPORTS=RGBA_PNG INPUT=JPEG INPUT=POSTGIS 
INPUT=OGR
 INPUT=GDAL INPUT=SHAPEFILE


More information about the mapserver-users mailing list