[mapserver-users] WMS Layer provided by MapSever rendering incorrectly in ol3.

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Tue Nov 17 05:49:36 PST 2015


Hi,

Don’t use mode=map because you want to read Mapserver  as WMS. Make just a plain WMS layer like in view-source:http://dev.openlayers.org/examples/wms.html.

-Jukka Rahkonen-



Neelesh Nirmal wrote:

I have created a map using OpenLayers3 which contains two layers. First layer is Open Street Map Layer and the second one is WMS layer provided by the Map Server.
Problem-When i'm rendering first layer it is rendering properly no issue. but when i'm rendering the second layer(provide by map server) it renders incorrectly means it does not fit to its container and it is out of sync with the first layer in terms of location. See this snapshot<http://i.stack.imgur.com/Ac8xR.png> of the maps for more clarification. In the snapshot top layer is wms layer provided by map server.

[Lähettäjä poisti kuvan.]<http://i.stack.imgur.com/Ac8xR.png>



Also when i'm zooming or moving the map then both layers work correctly but after a delay of few seconds the second layer(wms layer from map server) again switches back to its initial position(Position that is shown in above attached snapshot).



This is the code that i'm using to consume wms service.



var layer = new ol.layer.Image({

    source: new ol.source.ImageWMS({

          url: 'http://localhost:19090/rasters/world/wms',

          params: {

               'LAYERS': 'world',

               'mode': 'map',

          },

          serverType: 'mapserver'

     })

});



This<http://pastebin.com/AWWWyBLE> is my map file.



 MAP

  NAME   "world"

  CONFIG "MS_ERRORFILE" "/home/neelesh/Projects/georbis/data/logs/mapservice_errors.log"

  CONFIG "PROJ_LIB" "/home/neelesh/Projects/georbis/deps/proj.4-master/share/proj"

  CONFIG "ON_MISSING_DATA" "LOG"

  DEBUG 5

  EXTENT -180.000 -90.000 180.000 90.000

  SHAPEPATH "/home/neelesh/Projects/georbis/data/service_data/data/wms"

  IMAGECOLOR 255 255 255

  SIZE 1350 675



  WEB

    METADATA

      "wms_title" "Georbis WMS Server"

      "wms_author" "VizExperts"

      "wms_onlineresource" "http://192.168.1.36:19090/rasters/world/wms?"

      "wms_enable_request" "*"

      "wms_srs" "epsg:4326"

      "wms_feature_info_mime_type" "text/html"

      "wms_format" "image/jpg"

    END

  END



  PROJECTION

    "init=epsg:4326"

  END



  LAYER

    NAME world

    TYPE RASTER

    DATA "world.tif"

    METADATA

      "wms_title" "BlueWorld Map"

      "wms_srs" "epsg:4326"

      "wms_server_version" "1.1.1"

    END

    PROJECTION

      "init=epsg:4326"

    END

  END

END

I tried ol.view.fit method to fit the layer to its container but the value of layer.getExtent() for the layer is undefined.

Also layers are rendering perfectly in QGIS and when i'm using the same layer from geoserver instead of mapserver again it is working fine.
This<http://stackoverflow.com/questions/33539777/wms-layer-provide-by-map-sever-rendering-incorrectly-in-ol3> is link to my stackoverflow post.

Pleas help me to find out what is wrong. is there any problem with wms request format or the map file?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20151117/7f7f55f0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1022 bytes
Desc: image001.jpg
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20151117/7f7f55f0/attachment-0001.jpg>


More information about the mapserver-users mailing list