1

I have got an issue with tiler (https://github.com/ropensci/tiler). 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 follow by using the files and putting them under a folder called /data, as you can see in the code, that is needed.

You can download the used files here at Gofile

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/____/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. It should be EPSG:4326 instead i guess.

<?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.

0

Just watch out for TMS-Tiles. tiler does export TMS-Tiles but even the viewer seems to be unprepared for that. I used leaflet-react and set the tms property with value "true" and it worked:

      <TileLayer
    attribution="&copy;  contributors"
    url={
      "/static/layers/" +
      currentProject.projectname +
      "/{z}/{x}/{y}.png"
    }
    tms="true"
    minZoom="10"
    maxZoom="18"
  />
| improve this answer | |

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.