{"id":7051,"date":"2023-04-14T14:24:29","date_gmt":"2023-04-14T13:24:29","guid":{"rendered":"https:\/\/www.thetawelle.de\/?p=7051"},"modified":"2023-04-15T11:34:21","modified_gmt":"2023-04-15T10:34:21","slug":"mastering-gdal-tools-ein-online-kurs-fuer-den-einstieg","status":"publish","type":"post","link":"https:\/\/www.thetawelle.de\/?p=7051","title":{"rendered":"Mastering GDAL Tools &#8211; ein Online Kurs f\u00fcr den Einstieg"},"content":{"rendered":"<p><a href=\"https:\/\/www.thetawelle.de\/wp-upload\/spatial_thoughts.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.thetawelle.de\/wp-upload\/spatial_thoughts.png\" alt=\"\" width=\"400\" height=\"312\" class=\"alignright size-full wp-image-7052\" srcset=\"https:\/\/www.thetawelle.de\/wp-upload\/spatial_thoughts.png 400w, https:\/\/www.thetawelle.de\/wp-upload\/spatial_thoughts-300x234.png 300w\" sizes=\"auto, (max-width: 400px) 85vw, 400px\" \/><\/a>Wer mit Geodaten arbeitet, der landet relativ fix bei der <a href=\"https:\/\/gdal.org\/\">Geospatial Data Abstraction Library (GDAL)<\/a>. Einem Open Source toolset, um eine ganze Menge an georaumbezogenen Datentransformationen durchf\u00fchren zu k\u00f6nnen.<\/p>\n<p>Leider ist die Dokumentation und die Tutorials eher so na ja bei gdal.org. Jetzt hab ich einen supercoole Quelle bei <a href=\"https:\/\/spatialthoughts.com\/courses\/\">Spatial Thoughts<\/a> gefunden, um sich mit den Tools richtig gut vertraut zu machen:<br \/>\n<a href=\"https:\/\/courses.spatialthoughts.com\/gdal-tools.html\">Mastering GDAL Tools (Full Course Material)<\/a><\/p>\n<blockquote><p>GDAL is an open-source library for raster and vector geospatial data formats. The library comes with a vast collection of utility programs that can perform many geoprocessing tasks and build scalable spatial <a href=\"https:\/\/www.snowflake.com\/guides\/etl-pipeline\">ETL pipelines<\/a> without the need for expensive software.<\/p><\/blockquote>\n<p>Ich hab mit den GDAL tools ein wenig herumexperimentiert und stelle fest, da steckt eine Menge Power drin.<\/p>\n<h2>Installation von GDAL<\/h2>\n<p>Die Installation ist ein wenig tricky. Auf macOS kann se auch etwas Zeit in Anspruch nehmen. Ich habe <a href=\"https:\/\/brew.sh\/\">Homebrew<\/a> benutzt und einfach folgende Zeile eingegeben:<\/p>\n<pre class=\"brush: bash; gutter: false; title: ; toolbar: false; notranslate\" title=\"\">brew install gdal<\/pre>\n<p>Ob alles geklappt hat, kann man testen, indem man eingibt:<\/p>\n<pre class=\"brush: bash; gutter: false; title: ; toolbar: false; notranslate\" title=\"\">gdalinfo --version<\/pre>\n<p>Das sollte die installierte Version ausgeben. Bei mir ist das gerade<br \/>\n<code>GDAL 3.6.3, released 2023\/03\/07<\/code><\/p>\n<h2>Maptiles generieren<\/h2>\n<p>So kann man z.B. sehr einfach seine eigenen WMTS\/WMS (Web Map Tile Service) erzeugen mit folgendem Befehl:<\/p>\n<pre class=\"brush: bash; gutter: false; title: ; toolbar: false; notranslate\" title=\"\">gdal2tiles.py land_shallow_topo_21600.tif --s_srs=wgs84 -d -p raster<\/pre>\n<p>Daf\u00fcr l\u00e4dt man einfach zuvor von z.B. der <a href=\"https:\/\/visibleearth.nasa.gov\/images\/57752\/blue-marble-land-surface-shallow-water-and-shaded-topography\">NASA eine Weltkarte<\/a> im Mercator Format (das ist das g\u00e4ngigste Format, dass auch Google nutzt) runter. Die NASA hat auch ein <a href=\"https:\/\/eoimages.gsfc.nasa.gov\/images\/imagerecords\/73000\/73884\/readme.pdf\">README.pdf<\/a> parat, das ein wenig erkl\u00e4rt, wie man die Daten nutzen kann.<\/p>\n<p>Um zu gucken, welche Metainformationen da in dem TIF enthalten sind kann man folgende Zeile eingeben:<\/p>\n<pre class=\"brush: bash; gutter: false; title: ; toolbar: false; notranslate\" title=\"\">gdalinfo land_shallow_topo_21600.tif<\/pre>\n<p>Das ergibt dann z.b. eine Ausgabe wie:<\/p>\n<pre class=\"brush: bash; gutter: true; title: Ausgabe; toolbar: false; notranslate\" title=\"Ausgabe\">\r\nDriver: GTiff\/GeoTIFF\r\nFiles: land_shallow_topo_21600.tif\r\nSize is 21600, 10800\r\nMetadata:\r\n  TIFFTAG_RESOLUTIONUNIT=2 (pixels\/inch)\r\n  TIFFTAG_XRESOLUTION=72\r\n  TIFFTAG_YRESOLUTION=72\r\nImage Structure Metadata:\r\n  COMPRESSION=LZW\r\n  INTERLEAVE=PIXEL\r\n  PREDICTOR=2\r\nCorner Coordinates:\r\nUpper Left  (    0.0,    0.0)\r\nLower Left  (    0.0,10800.0)\r\nUpper Right (21600.0,    0.0)\r\nLower Right (21600.0,10800.0)\r\nCenter      (10800.0, 5400.0)\r\nBand 1 Block=21600x1 Type=Byte, ColorInterp=Red\r\nBand 2 Block=21600x1 Type=Byte, ColorInterp=Green\r\nBand 3 Block=21600x1 Type=Byte, ColorInterp=Blue\r\n<\/pre>\n<p>Dann transformiert man das z.B. auch mit folgendem Tool in ein .png File:<\/p>\n<pre class=\"brush: bash; gutter: false; title: ; toolbar: false; notranslate\" title=\"\">gdal_translate -of png land_shallow_topo_21600.tif land_shallow_topo_21600.png<\/pre>\n<p>So bekommt man ein PNG aus dem TIFF.<\/p>\n<p><small><strong>Why do I blog this?<\/strong> Es ist nicht so leicht mit Geodaten zu arbeiten. Jede Hilfe die man bekommen kann ist da willkommen. Ich hab festgestellt, das man mit den GDAL tools &#8211; z.B. eingebunden per Python &#8211; eine ganze Menge Tricks machen kann.<\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wer mit Geodaten arbeitet, der landet relativ fix bei der Geospatial Data Abstraction Library (GDAL). Einem Open Source toolset, um eine ganze Menge an georaumbezogenen Datentransformationen durchf\u00fchren zu k\u00f6nnen. Leider ist die Dokumentation und die Tutorials eher so na ja bei gdal.org. Jetzt hab ich einen supercoole Quelle bei Spatial Thoughts gefunden, um sich mit &hellip; <a href=\"https:\/\/www.thetawelle.de\/?p=7051\" class=\"more-link\"><span class=\"screen-reader-text\">\u201eMastering GDAL Tools &#8211; ein Online Kurs f\u00fcr den Einstieg\u201c <\/span>weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,88,67,4,106],"tags":[],"class_list":["post-7051","post","type-post","status-publish","format-standard","hentry","category-best-practice","category-coding","category-english","category-learning","category-science"],"_links":{"self":[{"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=\/wp\/v2\/posts\/7051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7051"}],"version-history":[{"count":0,"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=\/wp\/v2\/posts\/7051\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thetawelle.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}