[mapserver-users] Help!

Özgür Arslan ozgurarslan81 at hotmail.com
Fri Apr 6 16:17:07 EDT 2012





 
Hi All,

I am new in open layers and I am trying to demonstrate my mapfile with Open layers. Can some one helm me about this please? Code lines are below:


<!-- MapServer Template --> 
   <html>
<head>
  <title>OpenLayers Example</title>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>
    </head>
    <body>
      <div style="width:100%; height:100%" id="map"></div>
      <script defer="defer" type="text/javascript">
        var map = new OpenLayers.Map('map');
        var wms = new OpenLayers.Layer.MapServer( "QGIS-MAP",
           "http://localhost/cgi-bin/wms?MODE=map&MAP=C:/wwwroot/QGISMap/QGISMap.map", {layers: 'province_dd'} );
        map.addLayer(wms);
        map.zoomToMaxExtent();
      </script>

</body>
</html>




# Map file created from QGIS project file
# Edit this file to customize for your map interface
# (Created with PyQgis MapServer Export plugin)
MAP
  NAME "QGIS-MAP"
  # Map image size
  SIZE 500 500
  UNITS meters
STATUS ON
  EXTENT -2400000 -900000 3100000 4000000
  FONTSET "/wwwroot/fonts/fontset.txt"
  SYMBOLSET '../symbols/symbols.sty'
  PROJECTION
    "proj=lcc"
    "ellps=GRS80"
    "lat_0=49"
    "lon_0=-95"
    "lat_1=49"
    "lat_2=77"
    "datum=NAD83"
    "units=m"
    "no_defs <>"
  END    

  SYMBOL
  NAME "S3"
  TYPE pixmap
  IMAGE '/wwwroot/symbols/S3.png'
  END # SYMBOL

  # Background color for the map canvas -- change as desired
  IMAGECOLOR 0 0 255
  IMAGEQUALITY 95
  IMAGETYPE png
CONFIG "CGI_CONTEXT_URL" "1"
  OUTPUTFORMAT
    NAME agg
    DRIVER AGG/PNG
    IMAGEMODE RGB
  END


  QUERYMAP
    STATUS ON 
        SIZE 500 500        # sets the map to be queryable
    STYLE HILITE             # the selected object is highligthed
        COLOR  0 255 0
    END # End for QueryMap

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

  # Legend
  LEGEND
    IMAGECOLOR 255 255 255
    STATUS ON
    KEYSIZE 18 12
    LABEL
      TYPE BITMAP
      SIZE MEDIUM
      COLOR 0 0 89
    END
  END

  # Web interface definition. Only the template parameter
  # is required to display a map. See MapServer documentation
  WEB
    # Set IMAGEPATH to the path where MapServer should
    # write its output.
    IMAGEPATH '/ms4w/tmp/ms_tmp/'

    # Set IMAGEURL to the url that points to IMAGEPATH
    # as defined in your web server configuration
    IMAGEURL '/ms_tmp/'

   HEADER    "header.html"
   FOOTER    "footer.html"
   EMPTY            "/maps/QGISMap/blank.html"

    # WMS server settings
    METADATA
      'ows_title'           'QGIS-MAP'
      'ows_onlineresource'  'localhost/cgi-bin/mapserv.exe?map=C:/wwwroot/QGISMap/QGISMap.map'
      'ows_srs'             'EPSG:4326'
    END

    #Scale range at which web interface will operate
    # Template and header/footer settings
    # Only the template parameter is required to display a map. See MapServer documentation
    TEMPLATE 'global.html'
  END

  LAYER
    NAME 'province_dd'
    TYPE POLYGON
    DUMP false
    CONNECTION "http://localhost/cgi-bin/wms?"
    CONNECTIONTYPE WMS

  EXTENT -148.317097 42.348600 -55.567680 86.032387
    DATA '../../../wwwroot/Data/province_dd.shp'
    METADATA
  'wms_onlineresource'  'http://localhost/cgi-bin/mapserv.exe?map=wms.map&'
    "wms_srs"             "EPSG:4326"
    "wms_name"            "province_dd"
    "wms_server_version"  "1.1.1"
    "wms_format"          "image/gif"
      #'ows_title' 'province_dd'
    END
    STATUS ON
    TRANSPARENCY 100
    PROJECTION
    'proj=longlat'
    'datum=WGS84'
    'no_defs'
    END
    LABELITEM 'NAME_ENG'
    CLASSITEM 'NAME_ENG'  
    CLASS
      NAME "Alberta" 
      EXPRESSION "Alberta" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 130 9 169
       END
      
    END
    CLASS
      NAME "British Columbia" 
      EXPRESSION "British Columbia" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 62 106 166
       END    
    END
    CLASS
      NAME "Manitoba" 
      EXPRESSION "Manitoba" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 176 232 23
       END    
    END
    CLASS
      NAME "New Brunswick" 
      EXPRESSION "New Brunswick" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 248 188 159
       END     
    END
    CLASS
      NAME "Newfoundland" 
      EXPRESSION "Newfoundland" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 172 33 56
       END      
    END
    CLASS
      NAME "Northwest Territories" 
      EXPRESSION "Northwest Territories" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 123 03 213
       END   
    END
    CLASS
      NAME "Nova Scotia" 
      EXPRESSION "Nova Scotia" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 187 66 185
       END    
    END
    CLASS
      NAME "Nunavut" 
      EXPRESSION "Nunavut" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 171 222 109
       END   
    END
    CLASS
      NAME "Ontario" 
      EXPRESSION "Ontario" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 250 20 201
       END
    END
    CLASS
      NAME "Prince Edward Island" 
      EXPRESSION "Prince Edward Island" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 69 153 254
       END
    END
    CLASS
      NAME "Quebec" 
      EXPRESSION "Quebec" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 6 170 235
       END
    END
    CLASS
      NAME "Saskatchewan" 
      EXPRESSION "Saskatchewan" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 251 167 144
       END
    END
    CLASS
      NAME "Yukon Territory" 
      EXPRESSION "Yukon Territory" 
       STYLE
         WIDTH 0.91 
         OUTLINECOLOR 0 0 0
         COLOR 26 34 69
       END
    END
  END

   LAYER
    NAME province_labels
    TYPE ANNOTATION
    STATUS ON
    DATA '../../../wwwroot/Data/province_dd.shp'
    LABELITEM 'NAME_ENG'
    CLASS
      LABEL
                TYPE truetype
                FONT "calibri"
                SIZE 9
        COLOR 255 255 255
        OUTLINECOLOR 0 0 0
        POSITION CC
        MINFEATURESIZE 100
          END # End for label           
       END # end for class
    PROJECTION
    "proj=latlong"
    "ellps=WGS84"
    END # End for projection
  END # End for layer

  LAYER
    NAME 'mjrroads'
    TYPE LINE
    DUMP false
  EXTENT -148.317097 42.348600 -55.567680 86.032387
    DATA '../../../wwwroot/Data/mjrroads.shp'
    METADATA
      'ows_title' 'mjrroads'
    END
    STATUS ON
    TRANSPARENCY 100
    PROJECTION
    'proj=longlat'
    'datum=WGS84'
    'no_defs'
    END
    CLASSITEM 'TYPE' 
    
    HEADER "mjrroads_header.html"
    FOOTER "mjrroads_footer.html"

    TOLERANCE 5
    TOLERANCEUNITS PIXELS
   

    CLASS
      NAME "Primary Highway" 
      EXPRESSION "Primary Highway"
    MAXSCALE 2500000 
    TEMPLATE "mjrroads_query.html"
   
    STYLE  
         WIDTH 1 
         COLOR 0 0 0
       END
  END
  CLASS
      TEMPLATE "mjrroads_query.html"
      NAME "Expressway" 
      EXPRESSION "Expressway" 
    STYLE  
          WIDTH 2 
         COLOR 255 0 0
       END
    END
  END

  LAYER
    NAME major_city_labels
    TYPE ANNOTATION
    STATUS ON
    MAXSCALE 1000000
        DATA '../../../wwwroot/Data/mjcities'
    LABELITEM 'NAME'
    CLASS
        LABEL
                TYPE truetype
                FONT "calibri"
                SIZE 8
        COLOR 0 0 0
                OUTLINECOLOR 255 255 255
        POSITION CC
        MINFEATURESIZE 100
        END # End for label
        END # end for class
    PROJECTION
    "proj=latlong"
    "ellps=WGS84"
    END # End for projection
  END # End for layer

  LAYER
    NAME 'mjcities'
    TYPE POINT
    DUMP false
  EXTENT -148.317097 42.348600 -55.567680 86.032387
    DATA '../../../wwwroot/Data/mjcities.shp'
    METADATA
      'ows_title' 'mjcities'
    END

    STATUS ON
    MAXSCALE 2500000 
    TRANSPARENCY 100
    PROJECTION
    'proj=longlat'
    'datum=WGS84'
    'no_defs'
    END
    CLASS
       NAME 'mjcities'
      STYLE
       SYMBOL "S3" 
       SIZE 17
       OUTLINECOLOR 0 0 0
       COLOR 0 0 255
      END
      
    END
  END
  END
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120406/3ebac501/attachment-0001.html


More information about the mapserver-users mailing list