[Dutch] Leaflet tile URL probleem

Steven M. Ottens steven op minst.net
Wo Apr 15 00:59:57 PDT 2015


Hoi Allemaal,

Ik ben er ook een keer tegenaan gelopen en de versie van Proj4Leaflet 
die ik gebruikte had een bug in de functie _calculateSizes() De nieuwste 
versie van proj4leaflet lijkt de bug niet te hebben, maar die heb ik 
verder niet getest.


Origineel wordt de grootte van de projectbounds horizontaal gedeeld door 
de schaal (bold) en verticaal vermenigvuldigd met de schaal (italic):

     _calculateSizes: function() {
             var sizes = [],
                 crsBounds = this.projectedBounds,
                 projectedTileSize,
                 upperY,
                 i;
             for (i = this._scales.length - 1; i >= 0; i--) {
                 if (this._scales[i]) {
                     projectedTileSize = this.options.tileSize / 
this._scales[i];
                     upperY = crsBounds[1] + Math.ceil((crsBounds[3] - 
crsBounds[1]) /
                                             projectedTileSize) * 
projectedTileSize;
                     sizes[i] = L.point(*(crsBounds[2] - crsBounds[0]) / 
this._scales[i]*,
/(upperY - crsBounds[1]) * this._scales[i])/;
                 }
             }

             return sizes;
         },

Correct is beide vermenigvuldigen met de schaal:
     _calculateSizes: function() {
             var sizes = [],
                 crsBounds = this.projectedBounds,
                 projectedTileSize,
                 upperY,
                 i;
             for (i = this._scales.length - 1; i >= 0; i--) {
                 if (this._scales[i]) {
                     projectedTileSize = this.options.tileSize / 
this._scales[i];
                     upperY = crsBounds[1] + Math.ceil((crsBounds[3] - 
crsBounds[1]) /
                                             projectedTileSize) * 
projectedTileSize;
                     sizes[i] = L.point((crsBounds[2] - crsBounds[0]) * 
this._scales[i],
                         (upperY - crsBounds[1]) * this._scales[i]);
                 }
             }

             return sizes;
         },



On 14/04/15 22:44, Edward Mac Gillavry wrote:
> Zet ik trouwens de maxZoom op 16 voor de referentiekaartlaag, dan 
> krijg ik ook fracties in de URL's naar bijvoorbeeld de 
> BRT-Achtergrondkaart op zoomniveaus 15 en 16. Het is dus niet 
> specifiek voor de luchtfoto's maar wel op een ander zoomniveau. 
> Hopelijk sluiten we zo steeds meer uit.
>
> Groet,
>
> Edward
>
>
> ------------------------------------------------------------------------
> From: emacgillavry at hotmail.com
> To: ron at rwgc.nl; dutch at lists.osgeo.org
> Date: Tue, 14 Apr 2015 22:30:51 +0200
> Subject: Re: [Dutch] Leaflet tile URL probleem
>
> Ha Ron,
>
> Nieuwsgierig geworden heb ik even een poging gewaagd. Stuitte op 
> dezelfde issues en constateerde, dat ik normaal gesproken een andere 
> bbox gebruik voor het tile grid, namelijk
>
> -285401.92,22598.08,595401.91,903401.92 (genoemd in de Geonovum tiling 
> richtlijn [1], pagina 6)
>
> ipv
>
> -285401.92,22598.08,595401.9199999999,903401.9199999999
>
> Dit maakte echter geen verschil. Ook zag ik, dat de resolutions array 
> nog extra entries nodig heeft voor de diepste zoomniveaus:
>
> resolutions: [3440.640, 1720.320, 860.160, 430.080, 215.040, 107.520, 
> 53.760, 26.880, 13.440, 6.720, 3.360, 1.680, 0.840, 0.420, 0.21, 
> 0.105,  0.0575]
>
> (genoemd in de Geonovum tiling richtlijn [1], in de tabel op pagina 13)
>
> Dit maakte echter nog steeds geen verschil ;-(. Toen keek ik ook nog 
> even naar de PDOK-Kaartwizard [2]. Ook hier gebeurt het, dat je bij 
> het gebruik van de lufo op de diepste zoomniveaus fracties krijgt in 
> de URL's die de tegels ophalen... Kortom: het lijkt niet een specifiek 
> Leaflet issue te zijn. Maar waar ligt het dan wel aan?
>
> Groetjes,
>
> Edward
>
> [1] 
> http://www.geonovum.nl/sites/default/files/nederlandse_richtlijn_tiling_-_versie_1.1.pdf
> [2] http://kaart.pdok.nl/
>
> ------------------------------------------------------------------------
> From: ron at rwgc.nl
> Date: Tue, 14 Apr 2015 20:55:38 +0200
> To: dutch at lists.osgeo.org
> Subject: [Dutch] Leaflet tile URL probleem
>
> Hallo OSGeo.nl <http://OSGeo.nl>-ers,
>
> Bij het maken van een heel basic Leaflet kaart loop ik tegen een 
> probleem aan met de tile URL en hopelijk weet iemand raad.
>
> Ik heb het voorbeeld met de PDOK BRT TMS in Leaflet die door Bart van 
> den Eijnden is gemaakt genomen als basis (zie 
> https://github.com/bartvde/PDOK-Leaflet).
>
> Daar heb ik de open luchtfoto TMS aan toegevoegd. Dat werkt prima maar 
> bij zoom level 12 en hoger gaat het mis. Dan treedt er een 
> afrondingsfout op in de tile URL die er voor zorgt dat de luchtfoto op 
> die levels niet getoond wordt.
>
> Leaflet vraagt dan:
> http://geodata1.nationaalgeoregister.nl/luchtfoto/tms/1.0.0/luchtfoto/EPSG28992/12/2402.0000000000005/2602.jpeg
> en dat levert niets op want de gewenste tile is:
> http://geodata1.nationaalgeoregister.nl/luchtfoto/tms/1.0.0/luchtfoto/EPSG28992/12/2402/2602.jpeg
>
> Het vreemde is ook dat dit niet optreedt bij de BRT service.
>
> Ik zou zeggen, een simpele round functie ergens volstaat maar waar?
>
> NB dit is de config in script.js :
>
> var RD = new L.Proj.CRS.TMS(
>     'EPSG:28992',
>     '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889
> +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m
> +towgs84=565.2369,50.0087,465.658,-0.406857330322398,0.350732676542563,-1.8703473836068,4.0812
> +no_defs',
>   [-285401.92,22598.08,595401.9199999999,903401.9199999999], {
>     resolutions: [3440.640, 1720.320, 860.160, 430.080, 215.040,
> 107.520, 53.760, 26.880, 13.440, 6.720, 3.360, 1.680, 0.840, 0.420]
> });
>
> var map = new L.Map('map', {
>   continuousWorld: true,
>   crs: RD,
>   layers: [
>     new
> L.TileLayer('http://geodata.nationaalgeoregister.nl/tms/1.0.0/brtachtergrondkaartpastel@EPSG:28992@png8/{z}/{x}/{y}.png' 
> <http://geodata.nationaalgeoregister.nl/tms/1.0.0/brtachtergrondkaartpastel%40EPSG:28992%40png8/%7bz%7d/%7bx%7d/%7by%7d.png%27>,
> {
>         tms: true,
>         minZoom: 3,
>         maxZoom: 14,
>         attribution: 'Kaartgegevens: © <a
> href="http://www.cbs.nl">CBS</a>, <a
> href="http://www.kadaster.nl">Kadaster</a>, <a
> href="http://openstreetmap.org">OpenStreetMap</a><span
> class="printhide">-auteurs (<a
> href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>).</span>',
>         continuousWorld: true,
>         opacity: 0.5
>     }),
>     new
> L.TileLayer('http://geodata1.nationaalgeoregister.nl/luchtfoto/tms/1.0.0/luchtfoto/EPSG28992/{z}/{x}/{y}.jpeg' 
> <http://geodata1.nationaalgeoregister.nl/luchtfoto/tms/1.0.0/luchtfoto/EPSG28992/%7bz%7d/%7bx%7d/%7by%7d.jpeg%27>,
> {
>         tms: true,
>         minZoom: 3,
>         maxZoom: 14,
>         attribution: 'Kaartgegevens: © <a
> href="http://www.kadaster.nl">Kadaster</a>.</span>',
>         continuousWorld: false,
>         opacity: 0.5,
>         maxNativeZoom: 14 // The map will use zoom level 14 (max
> luchtfoto zoom level) tiles for all zoom levels beyond this level
>     })
>   ],
>   //center: new L.LatLng(52, 5.3),
>   center: new L.LatLng(53.223606, 6.532480),
>   zoom: 9,
>   minZoom: 3,
>   maxZoom: 14,
> });
> // test RD coordinates
> map.on('click', function(e) {
>     if (window.console) {
>         var point = RD.projection.project(e.latlng);
>         console.log("RD X: " + point.x + ", Y: " + point.y);
>     }
> });
>
> // functie om huidig zoom level in het kaartbeeld te tonen
> map.on('zoomend', function(){
>     document.getElementById('zoom-level').innerHTML = 'Zoom Level: ' +
> map.getZoom();
> });
>
>
>
>
> Bedankt en groeten,
> Ron Wardenier
>
> _______________________________________________ Dutch mailing list 
> Dutch at lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/dutch
>
> _______________________________________________ Dutch mailing list 
> Dutch at lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/dutch
>
>
> _______________________________________________
> Dutch mailing list
> Dutch at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/dutch

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/dutch/attachments/20150415/cb98338f/attachment-0001.html>


Meer informatie over de Dutch maillijst