stuartmatthews / Leaflet.NonTiledLayer.WCS

Leaflet plugin for displaying data from a Web Coverage Service
MIT License
10 stars 0 forks source link

CRS in WCS request #1

Open rmarzocchi84 opened 6 years ago

rmarzocchi84 commented 6 years ago

wcsLayer=L.nonTiledLayer.wcs("http://localhost:8080/rasdaman/ows", { wcsOptions: { coverage: 'fwi_20171220', version: '2.0.1', format: 'image/tiff', }, displayMin: 1, displayMax: 100, colorScale: 'rainbow', clampLow: false, clampHigh: false, uppercase: true, useCanvas: true, }).addTo(mymap);

document.getElementById('colorScaleImage').setAttribute('src',wcsLayer.colorScaleData);

First of all I changed "coverage" option:

coverage --> coverageid and it works

Then I changed format: 'GeoTIFF', --> format: 'image/tiff', and it works!

But how I can change the CRS of the WCS?

My WCS is not in 3857 so I need to change the CRS of my getcapabilities request..

http://localhost:8080/rasdaman/ows?&SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&coverageid=fwi_20171220&FORMAT=image%2Fpng&CRS=EPSG%3A3857&WIDTH=1109&HEIGHT=768&BBOX=551569.5961058319,5465553.270503244,1229718.9110519157,5935182.3722873675

-->

http://localhost:8080/rasdaman/ows?&SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&coverageid=fwi_20171220&FORMAT=image%2Fpng&CRS=EPSG%3A3003&WIDTH=1109&HEIGHT=768&BBOX=551569.5961058319,5465553.270503244,1229718.9110519157,5935182.3722873675

@stuartmatthews

rmarzocchi84 commented 6 years ago

Ok I performed new test:

1) I add the plugin Proj4Leaflet

<script src="../webservice/Proj4Leaflet/lib/proj4.js"></script>
<script src="../webservice/Proj4Leaflet/src/proj4leaflet.js"></script>

2) I define the crs

e.g.

var crs = new L.Proj.CRS('EPSG:3003',
  '+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl +units=m +no_defs s',
  {
    resolutions: [
      8192, 4096, 2048, 1024, 512, 256, 128
    ],
    origin: [0, 0]
  })

3) I use the crs option in my L.nonTiledLayer.wcs constructor


wcsLayer=L.nonTiledLayer.wcs("http://192.168.2.28:8080/rasdaman/ows", {
                wcsOptions: {
                    coverageid: 'fwi_20171220',
                    version: '2.0.1',
                    format: 'image/tiff',
                },
                crs:crs,    
                displayMin: 1,
                displayMax: 100,
                colorScale: 'rainbow',
                clampLow: false,
                clampHigh: false,
                uppercase: true,
                useCanvas: true,
            }).addTo(mymap);

Now the getcoverage request is correct: http://localhost:8080/rasdaman/ows?SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&COVERAGE=1&FORMAT=image%2Ftiff&COVERAGEID=fwi_20171220&CRS=EPSG%3A3003&WIDTH=1109&HEIGHT=768&BBOX=1192229.193710701,4874169.6155716535,1664101.2067143728,5208608.187396298

but the tiff is always in the same position.

Practically the 3857 WCS request is correct!

http://localhost:8080/rasdaman/ows?&SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&coverageid=fwi_20171220&FORMAT=image%2Fpng&CRS=EPSG%3A3857&WIDTH=1109&HEIGHT=768&BBOX=551569.5961058319,5465553.270503244,1229718.9110519157,5935182.3722873675

because the BBOX change correctly, but the geotiff is not correctly georeferenced on the map.

My exampke is available here

any help is appreciate! @stuartmatthews