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

Michael Smith michael.smith.erdc at gmail.com
Tue Nov 17 03:36:36 PST 2015


Neelesh,

You need to set your map projection to match your basemap. You need to set
it to spherical mercator.

 PROJECTION
    "init=epsg:3857"
  END

Mike

----
Michael Smith
US Army Corps
Remote Sensing GIS/Center
michael.smith at usace.army.mil

From:  mapserver-users <mapserver-users-bounces at lists.osgeo.org> on behalf
of Neelesh Nirmal <neelesh.iiita at gmail.com>
Date:  Tuesday, November 17, 2015 at 5:37 AM
To:  <mapserver-users at lists.osgeo.org>
Subject:  [mapserver-users] WMS Layer provided by MapSever rendering
incorrectly in ol3.

> 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.
>  <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-re
> ndering-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?
> _______________________________________________ mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20151117/2e729ca2/attachment.htm>


More information about the MapServer-users mailing list