[mapserver-users] openlayers 3

hosain mohammadi hosain.moh00 at gmail.com
Fri May 13 22:17:12 PDT 2016


hello dears
i'd like to use openayers3 with ms4w 3.0.6 the below code is used.
some one know what is my problem.

<!doctype html>

<html lang="en">

  <head>

    <link rel="stylesheet" href="ol.css" type="text/css">

    <style>

      .map {
        height: 100%;
        width: 100%;
      }

    </style>

    <script src="ol.js" type="text/javascript"></script>

    <title>web gis</title>

  </head>

  <body>


    <div id="map"  class="map"></div>

    <script type="text/javascript">


    var extent = [530076.378119036 ,3955633.12330454 ,535309.119388271
,3958672.31583408];

    var layers = [

          new ol.layer.Tile({

              title: "tehran",

              extent: extent,

              source: new ol.source.TileWMS({

              url: "
http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/ol/tehran.map&
",

              params: {

                'LAYERS': 'tehran',

                'VERSION': '1.1.1',

               'FORMAT': 'image/png',

               'TILED': true


              },

              serverType: 'mapserver'

              })

          }),

            new ol.layer.Tile({

            source: new ol.source.OSM()

             })
        ];




    var projection = new ol.proj.Projection({

     code: 'EPSG:32639',

     units: 'm'
     });

            var  view = new ol.View({

            center: [532416 ,3957232],

            extent: extent,

            zoom: 15,

            projection: projection


              });




        var map = new ol.Map({

          layers: layers,

          view: view,

          renderer: "canvas",

          target: 'map',

          controls: ol.control.defaults().extend([

           new ol.control.ScaleLine(),

           new ol.control.MousePosition()

          ])

           });


    </script>

  </body>

</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20160514/ce982f99/attachment.html>


More information about the mapserver-users mailing list