I don't get the tiles in the right reference system
Leverkusen opened this issue · 1 comments
I am setting up a webapplication and want to convert .grd files to tiles that can be read by Leaflet.
This example can be easily followed by using the files and putting them under a folder called /data, as you can see in the code, that is needed.
here are the needed files: aoa_result_2.zip
I had to set the routes with tiler_options because there where some errors with systemvariables and the paths. But it runs and there is a output. But the tiles are obviously not in the right reference system. This is my code (remember to install and load the package):
tiler_options(osgeo4w = "C:/OSGeo4W64/OSGeo4W.bat", python="C:/Users/**_USERNAME_**/AppData/Local/Programs/Python/Python37/python.exe")
tile(file= 'data/aoa_result_2.grd',
tiles= 'layers/aoa_result',
zoom="10-13",
viewer= TRUE,
)
Even the passed viewer can't display the layer correctly. The XML file shows that the EPSG is 3857 but I guess that is not right for leaflet. Shouldn't it be EPSG:4326 instead?
<?xml version="1.0" encoding="utf-8"?>
<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">
<Title>tmp_raster.tif</Title>
<Abstract></Abstract>
<SRS>EPSG:3857</SRS>
<BoundingBox minx="7.40000709521776" miny="51.85465878258405" maxx="7.82132047624863" maxy="52.06491340494047"/>
<Origin x="7.40000709521776" y="51.85465878258405"/>
<TileFormat width="256" height="256" mime-type="image/png" extension="png"/>
<TileSets profile="mercator">
<TileSet href="10" units-per-pixel="152.87405654296876" order="10"/>
<TileSet href="11" units-per-pixel="76.43702827148438" order="11"/>
<TileSet href="12" units-per-pixel="38.21851413574219" order="12"/>
<TileSet href="13" units-per-pixel="19.10925706787109" order="13"/>
</TileSets>
</TileMap>
I tried some reprojections but always got the same refsys and can't display it in my leaflet app nor in the viewere.
Thank you for helping
It seems that i just forgot about the point that tiler generates TMS-Tiles. I thought i checked that. Now all is working. Just added the tms="true" param to my react-leaflet TileLayer.
<TileLayer
attribution="© contributors"
url={
"/static/layers/" +
currentProject.projectname +
"/{z}/{x}/{y}.png"
}
tms="true"
minZoom="10"
maxZoom="18"
/>
But still the generated viewer does not show the tiles.