<div dir="ltr"><span style="font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;font-size:15px;line-height:19.5px">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.</span><br style="font-size:12.8px"><div style="font-size:12.8px"><font face="Arial, Helvetica Neue, Helvetica, sans-serif"><span style="font-size:15px;line-height:19.5px"><b>Problem-</b></span></font><span style="font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;font-size:15px;line-height:19.5px">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 </span><a href="http://i.stack.imgur.com/Ac8xR.png" rel="nofollow" target="_blank" style="color:rgb(12,101,165);font-size:15px;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px">this snapshot</a><span style="font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;font-size:15px;line-height:19.5px"> of the maps for more clarification. In the snapshot top layer is wms layer provided by map server.</span></div><p style="font-size:12.8px;clear:both"><a href="http://i.stack.imgur.com/Ac8xR.png" target="_blank" style="margin-left:1em;margin-right:1em"><img src="http://i.stack.imgur.com/Ac8xR.png" border="0" width="320" height="180" class=""></a></p><p style="font-size:12.8px;clear:both"><br></p><p style="font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px">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).</p><p style="font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px"><br></p><p style="font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px">This is the code that i'm using to consume wms service.</p><p style="font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px"><br></p><pre style="white-space:pre-wrap;font-size:12.8px;padding:5px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;color:rgb(57,51,24);word-wrap:normal;background-color:rgb(238,238,238)"><code style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><span style="color:rgb(0,0,139)">var</span><span style="color:rgb(0,0,0)"> layer </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,139)">new</span><span style="color:rgb(0,0,0)"> ol</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(0,0,0)">layer</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(43,145,175)">Image</span><span style="color:rgb(0,0,0)">({</span><span style="color:rgb(0,0,0)">
    source</span><span style="color:rgb(0,0,0)">:</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,139)">new</span><span style="color:rgb(0,0,0)"> ol</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(0,0,0)">source</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(43,145,175)">ImageWMS</span><span style="color:rgb(0,0,0)">({</span><span style="color:rgb(0,0,0)">
          url</span><span style="color:rgb(0,0,0)">:</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(128,0,0)">'<a href="http://localhost:19090/rasters/world/wms" target="_blank">http://localhost:19090/rasters/world/wms</a>'</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,0)">
          </span><span style="color:rgb(0,0,139)">params</span><span style="color:rgb(0,0,0)">:</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,0)">{</span><span style="color:rgb(0,0,0)">
               </span><span style="color:rgb(128,0,0)">'LAYERS'</span><span style="color:rgb(0,0,0)">:</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(128,0,0)">'world'</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,0)">
               </span><span style="color:rgb(128,0,0)">'mode'</span><span style="color:rgb(0,0,0)">:</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(128,0,0)">'map'</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,0)">
          </span><span style="color:rgb(0,0,0)">},</span><span style="color:rgb(0,0,0)">
          serverType</span><span style="color:rgb(0,0,0)">:</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(128,0,0)">'mapserver'</span><span style="color:rgb(0,0,0)">
     </span><span style="color:rgb(0,0,0)">})</span><span style="color:rgb(0,0,0)">
</span><span style="color:rgb(0,0,0)">});</span></code></pre><div style="font-size:12.8px;border:1px solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,250)"><code><div></div></code></div><p style="font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px"><br></p><p style="font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px"><a href="http://pastebin.com/AWWWyBLE" rel="nofollow" target="_blank" style="color:rgb(12,101,165)">This</a> is my map file.</p><p style="font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px"><br></p><pre style="white-space:pre-wrap;font-size:12.8px;padding:5px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;word-wrap:normal;background-color:rgb(238,238,238)"> 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" "<a href="http://192.168.1.36:19090/rasters/world/wms" target="_blank">http://192.168.1.36:19090/rasters/world/wms</a>?"
      "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</pre><div style="font-size:12.8px;border:1px solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,250)"><code><div></div></code></div><p style="font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px"><br>I tried <strong><em>ol.view.fit</em></strong> method to fit the layer to its container but the value of <strong><em>layer.getExtent()</em></strong> for the layer is undefined.</p><p style="font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px">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.<br><a href="http://stackoverflow.com/questions/33539777/wms-layer-provide-by-map-sever-rendering-incorrectly-in-ol3" target="_blank">This</a> is link to my stackoverflow post.</p><p style="font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px">Pleas help me to find out what is wrong. is there any problem with wms request format or the map file?</p></div>