1

in Leaflet JS I instantiated a WMS tile layer object, given a base URL of the WMS service.
The wms service projection system is EPSG:32633 (WGS 84 / UTM zone 33N) and I had to use proj4js to project it properly on Leaflet object.

WMS url: webapps.sit.puglia.it/arcgis/services/BaseMaps/Ortofoto2013/‌​…?

var crs = L.CRS.proj4js('EPSG:32633', '+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'); 
var ortoOpt = { 
    layers: ["0"], 
    format: "image/png", 
    transparent: true, 
    request: "GetMap", 
    version: "1.3.0", 
    service: "WMS", 
    crs: crs 
  }; 
var ortofotoLayer = L.tileLayer.wms(wms_baseurl, ortoOpt); 

Sadly, especially with higher zoom, the tiles appear misaligned, as in the picture.

screenwms.jpg

It's possible to fix this?

3
  • please add some more detail to your question, such as code, tile matrixes, WMS url etc Commented Oct 4, 2016 at 15:20
  • I would try with out passing in the CRS to the WMS Commented Oct 28, 2016 at 15:18
  • It's correct, and now works as it should! I thought that was it mandatory to specify the crs, because I felt that the projection system of the WMS was incompatible with Leaflet ... The solution was simpler than I thought ... Thanks! Commented Oct 28, 2016 at 16:06

1 Answer 1

2

In general it is best to allow the WMS and Leaflet determine the CRS of your requests (using the map projection) than to override it using a parameter in the WMS options.

So in your case the options should be:

var ortoOpt = { 
    layers: ["0"], 
    format: "image/png", 
    transparent: true, 
    request: "GetMap", 
    version: "1.3.0", 
    service: "WMS", 
  }; 
var ortofotoLayer = L.tileLayer.wms(wms_baseurl, ortoOpt);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.