[mapserver-users] openlayers 3

hosain mohammadi hosain.moh00 at gmail.com
Fri May 13 00:24:55 PDT 2016


hello

i'd like to use openlayers3 for wms service
the belowe code is correct?

<!doctype html>
<html lang="en">
  <head>
    <link rel="stylesheet" href="http://openlayers.org/en/v3.15.1/css/ol.css"
type="text/css">
    <style>
      .map {
        height: 100%;
        width: 100%;
      }
    </style>
    <script src="http://openlayers.org/en/v3.15.1/build/ol.js"
type="text/javascript"></script>
    <title>web gis</title>
  </head>
  <body>

    <div id="map"></div>
    <script type="text/javascript">

    var layers = [
          new ol.layer.Image({
            extent: [1062293,17704892,1085747,17720997],
            source: new ol.source.ImageWMS({
              url: '
http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/jask/jask.map
',
              params: {
                'LAYERS': 'jask',
                'CRS': 'EPSG:4326',
                'BBOX': '1062293,17704862,1085747,17720997',
                'FORMAT': 'image/png',
                'mode':'map'
              },
              serverType: 'mapserver'
            })
          })
        ];
    var projection = new ol.proj.Projection({
     code: 'EPSG:4326',
     units: 'm'
     });

        var map = new ol.Map({
          layers: layers,
          target: 'map',
          controls: [
              new ol.control.Zoom(),
              new ol.control.ZoomSlider()
          ],

          view: new ol.View({
            center: [1073136.94,17716190.89],
            zoom: 13,
            projection: projection
          })
        });



    </script>
  </body>
</html>



someone has offer?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20160513/f387adb7/attachment.htm>


More information about the MapServer-users mailing list