{"id":394,"date":"2024-10-26T20:17:37","date_gmt":"2024-10-26T20:17:37","guid":{"rendered":"https:\/\/www.acugis.com\/gis-tutorials\/?page_id=394"},"modified":"2024-10-26T20:32:35","modified_gmt":"2024-10-26T20:32:35","slug":"geoserver-imagemosaic-data-store","status":"publish","type":"page","link":"https:\/\/www.acugis.com\/gis-tutorials\/geoserver\/geoserver-imagemosaic-data-store\/","title":{"rendered":"GeoServer: ImageMosaic Data Store"},"content":{"rendered":"\n<p>This post will cover creating an ImageMosaic data store with GeoServer.<\/p>\n\n\n\n<p>If you have image files prepared, you can skip the &#8220;Prepare Files&#8221; section below.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Prepare files<\/strong><\/p>\n\n\n\n<p>We will use the London GeoTIFF image from&nbsp;<a href=\"https:\/\/www.planetobserver.com\/geospatial-data-samples\">PlanetSAT geospatial-data-samples<\/a>&nbsp;to create our mosaic. <\/p>\n\n\n\n<p>Create new directory &#8216;london&#8217; in your GeoServer data\/data directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">su - tomcat\ncd \/home\/tomcat-version\/webapps\/geoserver\/data\/data\nmkdir london\ncd london\nwget https:\/\/demo.planetobserver.com\/PlanetObserver_PlanetSAT_10m_UK_London_UTM30.zip\nunzip PlanetObserver_PlanetSAT_10m_UK_London_UTM30.zip \nrm -f PlanetObserver_PlanetSAT_10m_UK_London_UTM30.zip <\/pre>\n\n\n\n<p>Now, still in our &#8216;london&#8217; directory, let&#8217;s use gdal to create our tiles:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir tiles\ngdal_retile.py -v -r bilinear -levels 1 -ps 512 512 -co \"TILED=YES\" -co \"COMPRESS=JPEG\" -targetDir tiles PlanetObserver_PlanetSAT_10m_UK_London_UTM30.tif\n<\/pre>\n\n\n\n<p>After this we can remove the large TIFF file.&nbsp;<\/p>\n\n\n\n<p><strong>Note:<\/strong>&nbsp;gdal_retile.sh is part of the gdal-bin package in Ubuntu.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Create a Workspace<\/strong><\/p>\n\n\n\n<p>We&#8217;ll create a workspace, called &#8220;mosaic&#8221; as below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"448\" height=\"370\" src=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/workspace_save.png\" alt=\"\" class=\"wp-image-395\" srcset=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/workspace_save.png 448w, https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/workspace_save-300x248.png 300w\" sizes=\"auto, (max-width: 448px) 100vw, 448px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Optional: Use PostGIS<\/strong><\/p>\n\n\n\n<p>The ImageMosaic plugin generates a shape file for use with the Mosaic. <\/p>\n\n\n\n<p>If we wish to store this information in a PostGIS database, we can do so by adding a &nbsp;datastore.properties&nbsp;file to the Mosaic directory.<\/p>\n\n\n\n<p>You will need an existing PostGIS database or to create a database (it will not be created for you).<\/p>\n\n\n\n<p>The contents of the &nbsp;datastore.properties&nbsp;file should look as below.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SPI=org.geotools.data.postgis.PostgisNGDataStoreFactory\nhost=localhost\nport=5432\ndatabase=mydb\nschema=public\nuser=mydbuser\npasswd=SuperSecret\nLoose\\ bbox=true\nEstimated\\ extends=false\nvalidate\\ connections=true\nConnection\\ timeout=10\npreparedStatements=true<\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Create the Data Store<\/strong><\/p>\n\n\n\n<p>Go to&nbsp;Data \/ Stores\/ Add New<\/p>\n\n\n\n<p>Click on ImageMosaic in Raster Data Sources<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"416\" height=\"179\" src=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/imagemosaic.png\" alt=\"\" class=\"wp-image-396\" srcset=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/imagemosaic.png 416w, https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/imagemosaic-300x129.png 300w\" sizes=\"auto, (max-width: 416px) 100vw, 416px\" \/><\/figure>\n\n\n\n<p>Select our workspace (mosaic) and enter &#8220;<strong>london<\/strong>&#8221; as store name<\/p>\n\n\n\n<p>Browse to the $MOSAIC_DIR\/ as URL.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"599\" height=\"447\" src=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/browse_london.png\" alt=\"\" class=\"wp-image-397\" srcset=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/browse_london.png 599w, https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/browse_london-300x224.png 300w\" sizes=\"auto, (max-width: 599px) 100vw, 599px\" \/><\/figure>\n\n\n\n<p>Click OK and then click Save<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Create a New Layer<\/strong><\/p>\n\n\n\n<p>Go to&nbsp;Data \/ Layers \/ Add a new layer<\/p>\n\n\n\n<p>Select the mosaic:<strong>london<\/strong>&nbsp;entry<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"271\" height=\"351\" src=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/store_selected.png\" alt=\"\" class=\"wp-image-419\" srcset=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/store_selected.png 271w, https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/store_selected-232x300.png 232w\" sizes=\"auto, (max-width: 271px) 100vw, 271px\" \/><\/figure>\n\n\n\n<p>Click on Publish. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"846\" height=\"266\" src=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_publish.png\" alt=\"\" class=\"wp-image-401\" srcset=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_publish.png 846w, https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_publish-300x94.png 300w, https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_publish-768x241.png 768w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n\n\n\n<p>You will be taken to the &#8220;Edit Layer&#8221; menu, where you can change some parameters.<\/p>\n\n\n\n<p>You can edit various layer properties, as title, abstract, etc. In &#8220;Coverage Parameters&#8221; you can set &#8216;Multithreaded granule loading&#8217;, if you have multi-core CPU.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"508\" height=\"610\" src=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/edit_layer.png\" alt=\"\" class=\"wp-image-400\" srcset=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/edit_layer.png 508w, https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/edit_layer-250x300.png 250w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/figure>\n\n\n\n<p>When ready, click the Save button.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>View the Mosaic<\/strong><\/p>\n\n\n\n<p>Go to&nbsp;Data \/ Layer Preview<\/p>\n\n\n\n<p>Find the &#8220;mosaic:<strong>london<\/strong>&#8221; in Name column. You can use the search box on top<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"851\" height=\"204\" src=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_preview.png\" alt=\"\" class=\"wp-image-402\" srcset=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_preview.png 851w, https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_preview-300x72.png 300w, https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_preview-768x184.png 768w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Click on OpenLayers to view it. You can zoom in\/out and move around the map.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"779\" height=\"674\" src=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_map.png\" alt=\"\" class=\"wp-image-403\" srcset=\"https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_map.png 779w, https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_map-300x260.png 300w, https:\/\/www.acugis.com\/gis-tutorials\/wp-content\/uploads\/2024\/10\/layer_map-768x664.png 768w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n\n\n\n<p>You can learn more about the ImageMosaic Data Store at:<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.geoserver.org\/main\/en\/user\/data\/raster\/imagemosaic\/index.html\">https:\/\/docs.geoserver.org\/main\/en\/user\/data\/raster\/imagemosaic\/index.html<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post will cover creating an ImageMosaic data store with GeoServer. If you have image files prepared, you can skip the &#8220;Prepare Files&#8221; section below. Prepare files We will use the London GeoTIFF image from&nbsp;PlanetSAT geospatial-data-samples&nbsp;to create our mosaic. Create new directory &#8216;london&#8217; in your GeoServer data\/data directory. Now, still in our &#8216;london&#8217; directory, let&#8217;s &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.acugis.com\/gis-tutorials\/geoserver\/geoserver-imagemosaic-data-store\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;GeoServer: ImageMosaic Data Store&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":48,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-394","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.acugis.com\/gis-tutorials\/wp-json\/wp\/v2\/pages\/394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.acugis.com\/gis-tutorials\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.acugis.com\/gis-tutorials\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.acugis.com\/gis-tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.acugis.com\/gis-tutorials\/wp-json\/wp\/v2\/comments?post=394"}],"version-history":[{"count":9,"href":"https:\/\/www.acugis.com\/gis-tutorials\/wp-json\/wp\/v2\/pages\/394\/revisions"}],"predecessor-version":[{"id":420,"href":"https:\/\/www.acugis.com\/gis-tutorials\/wp-json\/wp\/v2\/pages\/394\/revisions\/420"}],"up":[{"embeddable":true,"href":"https:\/\/www.acugis.com\/gis-tutorials\/wp-json\/wp\/v2\/pages\/48"}],"wp:attachment":[{"href":"https:\/\/www.acugis.com\/gis-tutorials\/wp-json\/wp\/v2\/media?parent=394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}