Hi Tom, great work!

When reading this either with terra or stars, as in

in.tif = "/vsicurl/http://s3.eu-central-1.wasabisys.com/eumap/lcv/lcv_landcover.hcl_lucas.corine.rf_p_30m_0..0cm_2019_eumap_epsg3035_v0.1.tif";

library(terra)
# terra version 1.1.5
plot(rast(in.tif))

#library(raster)
#plot(raster(in.tif))

library(stars)
# Loading required package: abind
# Loading required package: sf
# Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
plot(read_stars(in.tif))

I see that both plots show a continuous raster, not a categorical. We spent quite a bit of time recently in stars & tmap development to get handling and plotting of categorical rasters right (including those having a color table), but this file doesn't give proper access to the categories.

The metadata tags do have them:

stars::gdal_metadata(in.tif)
#  [1] "1=111 - Urban fabric"
#  [2] "10=212 - Permanently irrigated arable land"
#  [3] "11=213 - Rice fields"
#  [4] "12=221 - Vineyards"
#  [5] "13=222 - Fruit trees and berry plantations"
#  [6] "14=223 - Olive groves"
#  [7] "15=231 - Pastures"
#  [8] "16=311 - Broad-leaved forest"
#  [9] "17=312 - Coniferous forest"
# [10] "18=321 - Natural grasslands"
# [11] "19=322 - Moors and heathland"
# [12] "2=122 - Road and rail networks and associated land"
# [13] "20=323 - Sclerophyllous vegetation"
# [14] "21=324 - Transitional woodland-shrub"
# [15] "22=331 - Beaches, dunes, sands"
# [16] "23=332 - Bare rocks"
# [17] "24=333 - Sparsely vegetated areas"
# [18] "25=334 - Burnt areas"
# [19] "26=335 - Glaciers and perpetual snow"
# [20] "27=411 - Inland wetlands"
# [21] "28=421 - Maritime wetlands"
# [22] "29=511 - Water courses"
# [23] "3=123 - Port areas"
# [24] "30=512 - Water bodies"
# [25] "31=521 - Coastal lagoons"
# [26] "32=522 - Estuaries"
# [27] "33=523 - Sea and ocean"
# [28] "4=124 - Airports"
# [29] "5=131 - Mineral extraction sites"
# [30] "6=132 - Dump sites"
# [31] "7=133 - Construction sites"
# [32] "8=141 - Green urban areas"
# [33] "9=211 - Non-irrigated arable land"
# [34] "AREA_OR_POINT=Area"

but GDAL doesn't give access to those in a programmatic way. I've tried to add a .aux.xml file with the table, this worked locally (for both stars - after using droplevels() - and terra) and might as well work over the /vsicurl connection. File attached.

Many regards,


On 02/03/2021 18:30, Tomislav Hengl wrote:

We have mapped land cover classes for the 2000-2019 period for continental Europe at 30-m resolution using spatiotemporal Machine Learning (we used R and python for modeling). Explore the dynamic EU landscapes on your palm using the ODS-Europe viewer: https://maps.opendatascience.eu

To access almost 10TB of data using R you use the terra or similar
packages e.g.:

R> library(terra)
R> in.tif = "/vsicurl/http://s3.eu-central-1.wasabisys.com/eumap/lcv/lcv_landcover.hcl_lucas.corine.rf_p_30m_0..0cm_2019_eumap_epsg3035_v0.1.tif";
R> tif = rast(in.tif)

 From here you can use any native operation e.g. to crop some polygon
or resample / aggregate values (there is no need to download whole
data sets). A detailed tutorial on how to work with Cloud Optimized
GeoTiffs is available here: https://gitlab.com/openlandmap/global-layers/-/blob/master/tutorial/OpenLandMap_COG_tutorial.md.

Complete list of Cloud Optimized GeoTiffs we produced so far for Europe
is available here: https://gitlab.com/geoharmonizer_inea/eumap/-/blob/master/gh_raster_layers.csv

If not otherwise specified, the data available on this portal is licensed under the Open Data Commons Open Database License <https://opendatacommons.org/licenses/odbl/> (ODbL) and/or Creative Commons Attribution-ShareAlike 4.0 <https://creativecommons.org/licenses/by-sa/4.0/legalcode> and/or Creative Commons Attribution 4.0 <https://creativecommons.org/licenses/by/4.0/legalcode> International
license (CC BY).

Read more in: https://opengeohub.medium.com/europe-from-above-space-time-machine-learning-reveals-our-changing-environment-1b05cb7be520

If you experience any technical problems or if you discover a bug,
please report via: https://gitlab.com/geoharmonizer_inea/spatial-layers/-/issues

T. Hengl
https://opengeohub.org/about

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

--
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48151 Muenster, Germany
Phone: +49 251 8333081
<PAMDataset>
  <Metadata>
    <MDI key="1">111 - Urban fabric</MDI>
    <MDI key="10">212 - Permanently irrigated arable land</MDI>
    <MDI key="11">213 - Rice fields</MDI>
    <MDI key="12">221 - Vineyards</MDI>
    <MDI key="13">222 - Fruit trees and berry plantations</MDI>
    <MDI key="14">223 - Olive groves</MDI>
    <MDI key="15">231 - Pastures</MDI>
    <MDI key="16">311 - Broad-leaved forest</MDI>
    <MDI key="17">312 - Coniferous forest</MDI>
    <MDI key="18">321 - Natural grasslands</MDI>
    <MDI key="19">322 - Moors and heathland</MDI>
    <MDI key="2">122 - Road and rail networks and associated land</MDI>
    <MDI key="20">323 - Sclerophyllous vegetation</MDI>
    <MDI key="21">324 - Transitional woodland-shrub</MDI>
    <MDI key="22">331 - Beaches, dunes, sands</MDI>
    <MDI key="23">332 - Bare rocks</MDI>
    <MDI key="24">333 - Sparsely vegetated areas</MDI>
    <MDI key="25">334 - Burnt areas</MDI>
    <MDI key="26">335 - Glaciers and perpetual snow</MDI>
    <MDI key="27">411 - Inland wetlands</MDI>
    <MDI key="28">421 - Maritime wetlands</MDI>
    <MDI key="29">511 - Water courses</MDI>
    <MDI key="3">123 - Port areas</MDI>
    <MDI key="30">512 - Water bodies</MDI>
    <MDI key="31">521 - Coastal lagoons</MDI>
    <MDI key="32">522 - Estuaries</MDI>
    <MDI key="33">523 - Sea and ocean</MDI>
    <MDI key="4">124 - Airports</MDI>
    <MDI key="5">131 - Mineral extraction sites</MDI>
    <MDI key="6">132 - Dump sites</MDI>
    <MDI key="7">133 - Construction sites</MDI>
    <MDI key="8">141 - Green urban areas</MDI>
    <MDI key="9">211 - Non-irrigated arable land</MDI>
  </Metadata>
  <PAMRasterBand band="1">
    <CategoryNames>
      <Category></Category>
      <Category>111 - Urban fabric</Category>
      <Category>212 - Permanently irrigated arable land</Category>
      <Category>213 - Rice fields</Category>
      <Category>221 - Vineyards</Category>
      <Category>222 - Fruit trees and berry plantations</Category>
      <Category>223 - Olive groves</Category>
      <Category>231 - Pastures</Category>
      <Category>311 - Broad-leaved forest</Category>
      <Category>312 - Coniferous forest</Category>
      <Category>321 - Natural grasslands</Category>
      <Category>322 - Moors and heathland</Category>
      <Category>122 - Road and rail networks and associated land</Category>
      <Category>323 - Sclerophyllous vegetation</Category>
      <Category>324 - Transitional woodland-shrub</Category>
      <Category>331 - Beaches, dunes, sands</Category>
      <Category>332 - Bare rocks</Category>
      <Category>333 - Sparsely vegetated areas</Category>
      <Category>334 - Burnt areas</Category>
      <Category>335 - Glaciers and perpetual snow</Category>
      <Category>411 - Inland wetlands</Category>
      <Category>421 - Maritime wetlands</Category>
      <Category>511 - Water courses</Category>
      <Category>123 - Port areas</Category>
      <Category>512 - Water bodies</Category>
      <Category>521 - Coastal lagoons</Category>
      <Category>522 - Estuaries</Category>
      <Category>523 - Sea and ocean</Category>
      <Category>124 - Airports</Category>
      <Category>131 - Mineral extraction sites</Category>
      <Category>132 - Dump sites</Category>
      <Category>133 - Construction sites</Category>
      <Category>141 - Green urban areas</Category>
      <Category>211 - Non-irrigated arable land</Category>
    </CategoryNames>
    <Metadata>
      <MDI key="STATISTICS_APPROXIMATE">YES</MDI>
      <MDI key="STATISTICS_MAXIMUM">32</MDI>
      <MDI key="STATISTICS_MEAN">14.261915053291</MDI>
      <MDI key="STATISTICS_MINIMUM">1</MDI>
      <MDI key="STATISTICS_STDDEV">8.3957313545462</MDI>
      <MDI key="STATISTICS_VALID_PERCENT">84.13</MDI>
    </Metadata>
  </PAMRasterBand>
</PAMDataset>
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to