I have two maps one is OSM and one is google maps. I want show WMS with projection EPSG:2180 and when I switch layer to wms then features hidden and show border from WMS but wrong. When I set google map(ol3gl) then it's good to time when map crash - I can't zoom. I upload two images(there where is red, there is good) Some code with WMS:

 proj4.defs("EPSG:2180","+proj=tmerc +lat_0=0 +lon_0=19 +k=0.9993 +x_0=500000 +y_0=-5300000 +ellps=GRS80 +units=m +no_defs");
var extent = [171700.190996, 140135.919877, 861883.198003, 774942.471876];
var proj=ol.proj.get("EPSG:2180");

var projection = new ol.proj.Projection({
    code: 'EPSG:2180',
    extent: extent
var WMS=new ol.layer.Tile({
    extent: extent,
    source: new ol.source.TileWMS({
    url: 'http://mapserver.bdl.lasy.gov.pl/ArcGIS/services/WMS_BDL/mapserver/WMSServer',
    crossOrigin: null,
    projection: ol.proj.get('EPSG:2180'),
    params: {
        'LAYERS': '3',
        'FORMAT': 'image/png',
    serverType: /** @type {ol.source.WMSServerType} */ ('geoserver')
var _view=new ol.View({
    center: ol.proj.fromLonLat([0, 0], projection),
    zoom: 0,
    extent: [171700.190996, 140135.919877, 861883.198003, 774942.471876],
    projection: ol.proj.get('EPSG:2180'),

Image bad: enter image description here

Image with good result: enter image description here

  • The WMS you are using is not GeoServer, but in your code you state that it is. – nmtoken May 13 '17 at 6:41
  • I changed it for mapserver – Gabriel Domanowski May 15 '17 at 17:18
  • It's not mapserver either – nmtoken May 15 '17 at 17:33
  • It's an ArcGIS service​ – nmtoken May 15 '17 at 17:34

remove the line:

projection: ol.proj.get('EPSG:2180'),

as the WMS needs to return the image in the projection of your map which OpenLayers will fill in for you. The WMS server should handle the reprojection of your layer to the map's projection (and if it can't it is time to get a new WMS server that can).

  • So... Request automaticly generated is EPSG:3857, but then map doesn't show. – Gabriel Domanowski May 15 '17 at 18:05
  • See what I said about needing a better WMS then. – Ian Turton May 15 '17 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.