index.rst 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. .. _image_quickstart:
  2. Publishing a Image
  3. ==================
  4. This tutorial walks through the steps of publishing a World + Image with GeoServer.
  5. .. note:: This tutorial assumes that GeoServer is running at ``http://localhost:8080/geoserver``.
  6. Data preparation
  7. ----------------
  8. First let's gather that the data that we'll be publishing.
  9. #. Download the Natural Earth 1:50m Shaded Relief raster:
  10. * https://www.naturalearthdata.com/downloads/50m-raster-data/50m-shaded-relief/
  11. #. This file contains small scale 1:50m data:
  12. * :file:`SR_50M.prj`
  13. * :file:`SR_50M.README.html`
  14. * :file:`SR_50M.tfw`
  15. * :file:`SR_50M.tif`
  16. * :file:`SR_50M.VERSION.txt`
  17. This forms a world (the `tfw` file) plus image (the :file:`tif` file).
  18. #. Move these files into your GeoServer Data Directory :file:`data/ne` folder.
  19. Creating a new workspace
  20. ------------------------
  21. The next step is to create a workspace for the geopackage. A workspace is a folder used to group similar layers together.
  22. .. note:: This step is optional if you'd like to use an existing workspace. Usually, a workspace is created for each project, which can include stores and layers that are related to each other.
  23. #. In a web browser, navigate to ``http://localhost:8080/geoserver``.
  24. #. Log into GeoServer as described in the :ref:`logging_in` section.
  25. #. Navigate to :menuselection:`Data --> Workspaces`.
  26. #. Click the :guilabel:`Add new workspace` button to display the :guilabel:`New Workspace` page.
  27. #. You will be prompted to enter a workspace :guilabel:`Name` and :guilabel:`Namespace URI`.
  28. .. list-table::
  29. :widths: 30 70
  30. :width: 100%
  31. :stub-columns: 1
  32. * - Name:
  33. - :kbd:`tutorial`
  34. * - Namespace URI
  35. - :kbd:`http://localhost:8080/geoserver/tutorial`
  36. .. note:: A workspace name is an identifier describing your project. It must not exceed ten characters or contain spaces.
  37. .. note:: A Namespace URI (Uniform Resource Identifier) can usually be a URL associated with your project with an added trailing identifier indicating the workspace. The Namespace URI filed does not need to resolve to an actual valid web address.
  38. #. Press the :guilabel:`Submit` button.
  39. #. The ``tutorial`` workspace will be added to the :guilabel:`Workspaces` list.
  40. Create a store
  41. --------------
  42. Once the workspace is created, we are ready to add a new store. The store tells GeoServer how to connect to the geopackage.
  43. #. Navigate to :menuselection:`Data-->Stores`.
  44. #. This page displays a list of stores, including the type of store and the workspace that the store belongs to.
  45. #. In order to add the geopackage, you need to create a new store. Click the :guilabel:`Add new Store` button. You will be redirected to a list of the data sources supported by GeoServer. Note that the data sources are extensible, so your list may look slightly different.
  46. #. From the list of :guilabel:`Raster Data Sources` locate and click the :guilabel:`WorldImage` link.
  47. .. figure:: images/stores_rasters.png
  48. Raster Data Sources
  49. #. The :guilabel:`New Vector Data Source` page will display.
  50. #. Begin by configuring the :guilabel:`Basic Store Info`.
  51. .. list-table::
  52. :widths: 30 70
  53. :width: 100%
  54. :stub-columns: 1
  55. * - workspace
  56. - ``tutorial``
  57. * - Data Source Name
  58. - :kbd:`ShadedRelief`
  59. * - Description
  60. - :kbd:`Grayscale shaded relief of land areas.`
  61. This information is internal to GeoServer and is not used as part of the web service protocols. We recommend keeping the :guilabel:`Data Source Name` simple as they will be used to form folders in the data directory (so keep any operating system restrictions on character use in mind).
  62. .. figure:: images/layer_basic.png
  63. Basic Store info
  64. #. Connection parameters are used to establish the location of your data.
  65. #. Under :guilabel:`Connection Parameters`, browse to the location :guilabel:`URL` of the image, in our example :file:`file:data/ne/SR_50M.tif`.
  66. #. The :guilabel:`Connection Parameters` for our geopackage are:
  67. .. list-table::
  68. :widths: 30 70
  69. :width: 100%
  70. :stub-columns: 1
  71. * - database
  72. - :kbd:`file:data/ne/SR_50M.tif`
  73. The use of :guilabel:`read_only` above indicates that we will not be writing to this GeoPackage, allowing GeoServer to avoid managing write locks when accessing this content for greater performance.
  74. .. figure:: images/connection_params.png
  75. Connection Parameters
  76. #. Press :guilabel:`Save`.
  77. #. You will be redirected to the :guilabel:`New Layer` page (as this is the most common next step when adding a new data store).
  78. Creating a layer
  79. ----------------
  80. Now that we have located the image, we can publish this information as a layer.
  81. #. On the :guilabel:`New Layer` page, click :guilabel:`Publish` beside the ``SR_50M`` :guilabel:`layer name`.
  82. #. The :guilabel:`Edit Layer` page defines the data and publishing parameters for a layer.
  83. #. There are three critical pieces of information required on the :guilabel:`Data` tab before we can even save.
  84. * :guilabel:`Basic Resource Info` - describes how the layer is presented to others
  85. * :guilabel:`Coordinate Reference System` - establishes how the spatial data is to be interpreted or drawn on the world
  86. * :guilabel:`Bounding Boxes` - establishes where the dataset is located in the world
  87. #. Locate :guilabel:`Basic Resource Info` and define the layer:
  88. .. list-table::
  89. :widths: 30 70
  90. :width: 100%
  91. :stub-columns: 1
  92. * - Name
  93. - :kbd:`shaded`
  94. * - Title
  95. - :kbd:`Shaded Relief`
  96. * - Abstract
  97. - :kbd:`Grayscale shaded relief of land areas.`
  98. The naming of a layer is important, and while GeoServer does not offer restrictions many of the individual protocols will only work with very simple names.
  99. .. figure:: images/layer_basic.png
  100. Basic Resource Info
  101. #. Check the :guilabel:`Coordiante Reference Systems` information is as listed below.
  102. .. note:: In this case select ``Force declared`` to prefer the GeoServer internal EPSG database definition of WGS84 over the :file:`prj` file provided alongside the same image.
  103. .. list-table::
  104. :widths: 30 70
  105. :width: 100%
  106. :stub-columns: 1
  107. * - Native SRS
  108. - :kbd:`EPSG:4326`
  109. * - Declaired SRS
  110. - :kbd:`EPSG:4326`
  111. * - SRS Handling
  112. - ``Force declared``
  113. .. figure:: images/layer_crs.png
  114. Coordinate Reference Systems
  115. #. Locate :guilabel:`Bounding Boces` and generate the layer's bounding boxes by clicking the :guilabel:`Compute from SRS bounds` and then :guilabel:`Compute from native bounds` links.
  116. .. note:: In this case we are choosing a slightly larger bounding box that fully contains the image.
  117. .. figure:: images/layer_bbox.png
  118. Generating bounding boxes
  119. #. Press :guilabel:`Apply` to save your work thus far without closing the page.
  120. This is a good way to check that your information has been entered correctly, GeoServer will provide a warning if any required information is incomplete.
  121. #. Scroll to the top of the page and navigate to the :guilabel:`Publishing` tab.
  122. #. Locate the :guilabel:`WMS Settings` heading, where we can set the style.Ensure that the :guilabel:`Default Style` is set to ``raster``.
  123. .. figure:: images/layer_style.png
  124. WMS Settings
  125. #. Press :guilabel:`Save` to complete your layer edits.
  126. Previewing the layer
  127. --------------------
  128. In order to verify that the ``tutorial:shaded`` layer is published correctly, we can preview the layer.
  129. #. Navigate to the :menuselection:`Data > Layer Preview` page and find the ``tutorial:shaded`` layer.
  130. .. note:: Use the :guilabel:`Search` field with :kbd:`tutorial` as shown to limit the number of layers to page through.
  131. #. Click the :guilabel:`OpenLayers` link in the :guilabel:`Common Formats` column.
  132. #. An OpenLayers map will load in a new tab and display the imagery with the default raster style.
  133. You can use this preview map to zoom and pan around the dataset, as well as display the attributes of features.
  134. .. figure:: images/openlayers.png
  135. Preview map of shaded relief