installation.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. Installation
  2. --------------------
  3. #. Visit the :website:`website download <download>` page, locate your release, and download: :download_extension:`mapml`
  4. .. warning:: Make sure to match the version of the extension (for example |release| above) to the version of the GeoServer instance!
  5. #. Extract the contents of the archive into the :file:`WEB-INF/lib` directory of the GeoServer installation.
  6. #. Restart GeoServer.
  7. Configuration
  8. -------------
  9. Configuration can be done using the Geoserver administrator GUI. The MapML configuration is accessible in the *MapML Settings* section under the *Publishing* tab of the Layer or Layer Group Configuration page for the layer or layer group being configured. Here is the MapML Settings section, with some example values filled in:
  10. .. figure:: images/mapml_config_ui.png
  11. *Attributes to <feature caption> mapping* section allows to define a template so that feature caption can include attribute values.
  12. Double clicking on one entry of the List of Attributes, will append an *${attribute}* placeholder at the end of the Feature Caption Template String text area.
  13. For example, for the State layer, you can define a template showing the State Name and the number of persons,
  14. by following these steps:
  15. #. Write "State Name:" on the text area
  16. #. Double click on the *STATE_NAME* attribute from the list of attributes, which will result in appending the *${STATE_NAME}* placeholder to the previous text.
  17. #. Continue writing ", Persons:" on the text area
  18. #. Double click on the *PERSONS* attribute from the list of attributes, which will result in appending the *${PERSONS}* placeholder to the previous text.
  19. See the following gif showing the result.
  20. .. figure:: images/mapml_feature_caption.gif
  21. After having saved the configuration, the WFS output will looks like this, where on mouseover, you can see the feature caption being setup on top of the defined template:
  22. .. figure:: images/mapml_feature_captions_wfs.png
  23. There is also a MapML-specific global WMS setting in the *MapML Extension* section of the ``WMS`` Services Settings Page. This setting is used to control the handling of multi-layer requests.
  24. .. figure:: images/mapml_config_wms.png
  25. If the ``Represent multi-layer requests as multiple elements`` is checked (and the configuration is saved), an individually accessible <map-extent> element will be generated for each requested layer. The default is to represent the layers as a single (hidden) <map-extent>.
  26. .. figure:: images/mapml_wms_multi_extent.png
  27. Styles
  28. ------
  29. Like any WMS layer or layer group available from GeoServer, a comma-separated list of styles may be supplied in the WMS GetMap `styles` parameter. If no style name is requested, the default style will be used for that layer. For single-layer or single-layer group requests, the set of alternate styles is presented as an option list in the layer preview map's layer control, with the currently requested style indicated.
  30. .. figure:: images/mapml_preview_multiple_styles_menu.png
  31. Note that in order to ensure that the default layer style is properly available to the preview map's option list, make sure that the style is moved to the ``Available Styles`` list in the ``Publishing`` tab of the Layer Configuration page. If the style is set to ``Default`` but not explicitly made ``Available``, the style will not be available to MapML. Similarly but a with a slight variation in requirement, for Layer Groups, the 'default' layer group style must be copied and given a name matching `default-style-` plus the layer group name.
  32. License Info
  33. ^^^^^^^^^^^^
  34. Together these two attributes allow the administrator to define the contents of the ``<link rel=license>`` element in the MapML header. Here is an example of the resulting XML:
  35. <link href="https://creativecommons.org/licenses/by/4.0/" rel="license" title="Attribution 4.0 International (CC BY 4.0)"/>
  36. **License Title**
  37. The License Title will be included as the value of ``title`` attribute of the ``<link rel=license>`` element in the MapML header.
  38. **License Link**
  39. The License Link will be included as the value of ``href`` attribute of the ``<link rel=license>`` element in the MapML header, and should be a valid URL referencing the license document.
  40. Tile Settings
  41. ^^^^^^^^^^^^^
  42. Using tiles to access the layer can increase the performance of your web map. This is especially true if there is a tile cache mechanism in use between GeoServer and the browser client.
  43. **Use Tiles**
  44. If the "Use Tiles" checkbox is checked, by default the output MapML will define a tile-based reference to the WMS server. Otherwise, an image-based reference will be used. If one or more of the MapML-defined GridSets is referenced by the layer or layer group in its "Tile Caching" profile, GeoServer will generate tile references instead of generating WMS GetMap URLs in the MapML document body.
  45. Vector Settings
  46. ^^^^^^^^^^^^^^^
  47. MapML supports the serving of vector feature representations of the data. This results in a smoother user navigation experience, smaller bandwidth requirements, and more options for dynamic styling on the client-side.
  48. **Use Features**
  49. If the "Use Features" checkbox is checked, by default the output MapML will define a feature-based reference to the WMS server. Otherwise, an image-based reference will be used. Note that this option is only available for vector source data. MapML <map-extent> element with a feature link:
  50. .. code-block:: html
  51. <map-extent units="WGS84" label="Manhattan (NY) points of interest" checked="checked">
  52. <map-input name="z" type="zoom" min="0" max="21"/>
  53. <map-input name="xmin" type="location" rel="map" position="top-left" axis="longitude" units="gcrs" min="-74.0118315772888" max="-74.00153046439813"/>
  54. <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="latitude" units="gcrs" min="40.70754683896324" max="40.719885123828675"/>
  55. <map-input name="xmax" type="location" rel="map" position="top-right" axis="longitude" units="gcrs" min="-74.0118315772888" max="-74.00153046439813"/>
  56. <map-input name="ymax" type="location" rel="map" position="top-left" axis="latitude" units="gcrs" min="40.70754683896324" max="40.719885123828675"/>
  57. <map-input name="w" type="width" min="1" max="10000"/>
  58. <map-input name="h" type="height" min="1" max="10000"/>
  59. <map-link tref="http://localhost:8080/geoserver/tiger/wms?format_options=mapmlfeatures:true&amp;request=GetMap&amp;crs=MapML:WGS84&amp;bbox={xmin},{ymin},{xmax},{ymax}&amp;format=text/mapml&amp;language=en&amp;version=1.3.0&amp;transparent=true&amp;service=WMS&amp;layers=poi&amp;width={w}&amp;styles=&amp;height={h}" rel="features"/>
  60. </map-extent>
  61. When both "Use Tiles" and "Use Features" are checked, the MapML extension will request tiled maps in ``text/mapml`` format.
  62. The contents of the tiles will be clipped to the requested area, and feature attributes will be skiipped, as the MapML client cannot leverage them for the moment.
  63. **Feature Styling**
  64. Basic styling of vector features is supported by the MapML extension. The style is defined in the WMS GetMap request, and the MapML extension will convert the rules and style attributes defined in the SLD into CSS classes and apply those classes to the appropriate features. Note that this conversion is currently limited to basic styling and does not include transformation functions, external graphics, or styling dependent on individual feature attributes (non-static style values). See below for a more detailed compatibility table:
  65. +------------------+-------------------+-----------+
  66. | Symbolizer | Style Attribute | Supported |
  67. +==================+===================+===========+
  68. | PointSymbolizer | Opacity | yes |
  69. | +-------------------+-----------+
  70. | | Default Radius | yes |
  71. | +-------------------+-----------+
  72. | | Radius | yes |
  73. | +-------------------+-----------+
  74. | | Rotation | no |
  75. | +-------------------+-----------+
  76. | | Displacement | no |
  77. | +-------------------+-----------+
  78. | | Anchor Point | no |
  79. | +-------------------+-----------+
  80. | | Gap | no |
  81. | +-------------------+-----------+
  82. | | Initial Gap | no |
  83. | +-------------------+-----------+
  84. | | Well Known Name | yes |
  85. | +-------------------+-----------+
  86. | | External Mark | no |
  87. | +-------------------+-----------+
  88. | | Graphic Fill | no |
  89. | +-------------------+-----------+
  90. | | Fill Color | yes |
  91. | +-------------------+-----------+
  92. | | Fill Opacity | yes |
  93. | +-------------------+-----------+
  94. | | Stroke Color | yes |
  95. | +-------------------+-----------+
  96. | | Stroke Opacity | yes |
  97. | +-------------------+-----------+
  98. | | Stroke Width | yes |
  99. | +-------------------+-----------+
  100. | | Stroke Linecap | yes |
  101. | +-------------------+-----------+
  102. | | Stroke Dash Array | yes |
  103. | +-------------------+-----------+
  104. | | Stroke Dash Offset| yes |
  105. | +-------------------+-----------+
  106. | | Stroke Line Join | no |
  107. +------------------+-------------------+-----------+
  108. | LineSymbolizer | Stroke Linecap | yes |
  109. | +-------------------+-----------+
  110. | | Stroke Dash Array | yes |
  111. | +-------------------+-----------+
  112. | | Stroke Dash Offset| yes |
  113. | +-------------------+-----------+
  114. | | Stroke Line Join | no |
  115. +------------------+-------------------+-----------+
  116. | PolygonSymbolizer| Displacement | no |
  117. | +-------------------+-----------+
  118. | | Perpendicular Offs| no |
  119. | +-------------------+-----------+
  120. | | Graphic Fill | no |
  121. | +-------------------+-----------+
  122. | | Fill Color | yes |
  123. | +-------------------+-----------+
  124. | | Fill Opacity | yes |
  125. | +-------------------+-----------+
  126. | | Stroke Color | yes |
  127. | +-------------------+-----------+
  128. | | Stroke Opacity | yes |
  129. | +-------------------+-----------+
  130. | | Stroke Width | yes |
  131. | +-------------------+-----------+
  132. | | Stroke Linecap | yes |
  133. | +-------------------+-----------+
  134. | | Stroke Dash Array | yes |
  135. | +-------------------+-----------+
  136. | | Stroke Dash Offset| yes |
  137. | +-------------------+-----------+
  138. | | Stroke Line Join | no |
  139. +------------------+-------------------+-----------+
  140. | TextSymbolizer | ALL | no |
  141. +------------------+-------------------+-----------+
  142. | RasterSymbolizer | ALL | no |
  143. +------------------+-------------------+-----------+
  144. | Transformation | ALL | no |
  145. | Functions | | |
  146. +------------------+-------------------+-----------+
  147. | Zoom | ALL | yes |
  148. | Denominators | | |
  149. +------------------+-------------------+-----------+
  150. WMS GetMap considerations
  151. ^^^^^^^^^^^^^^^^^^^^^^^^^
  152. By default, each layer/style pair that is requested via the GetMap parameters is composed into a single <map-extent>...<map-link tref="...">...</map-extent> structure as exemplified above.
  153. If the 'Represent multi-layer requests as multiple elements' checkbox from the global WMS Settings page is checked as described above, a request for multiple layers or layer groups in MapML format will result in the serialization of a MapML document containing multiple <map-extent> elements. Each layer/style pair is represented by a <map-extent> element in the response. The <map-extent> elements are represented in the client viewer layer control settings as sub-layers, which turn on and off independently of each other, but which are controlled by the parent <layer-> element's state (checked / unchecked, opacity etc) (right-click or Shift+F10 to obtain context menus):
  154. .. figure:: images/mapml_wms_multi_extent.png
  155. With 'Represent multi-layer requests as multiple elements' checked, if two or more layers are requested in MapML format via the GetMap 'layers' parameter, the MapML extension serialize each layer's <map-extent> according to its "Use Features" and "Use Tiles" settings. Note that there is currently no "Use Features" setting available for layer groups.
  156. Tile Caching
  157. ^^^^^^^^^^^^
  158. In the Tile Caching tab panel of the Edit Layer or Edit Layer Group page, at the bottom of the page you will see the table of GridSets that are assigned to the layer or layer group.
  159. The values ``WGS84`` and ``OSMTILE`` are equivalent to the EPSG:4326 and EPSG:900913 built in GeoWebCache GridSets.
  160. However, for the MapML module to recognize these GridSets, you must select and use the MapML names. For new layers or layer groups, or newly created grid subsets for a layer or layer group, the MapML values are selected by default. For existing layers that you wish to enable the use of cached tile references by the MapML service, you will have to select and add those values you wish to support from the dropdown of available GridSets. The set of recognized values for MapML is ``WGS84`` (equivalent to EPSG:4326), ``OSMTILE`` (equivalent to EPSG:900913), ``CBMTILE`` (Canada Base Map) and ``APSTILE`` (Alaska Polar Stereographic).
  161. The MapML client will normally request image tiles against WMTS, but if configured to use feature output,
  162. it will try to use tiles in ``text/mapml`` format, which should be configured as a cacheable format
  163. in order to enable WMTS requests.
  164. .. figure:: images/mapml_tile_caching_panel_ui.png
  165. Starting with version 2.26.x of GeoServer, Sharding support and related configuration has been removed
  166. Dimension Config
  167. ^^^^^^^^^^^^^^^^
  168. **Dimension**
  169. The selected dimension (if any) is advertised in the mapml as an input with the appropriate value options or ranges, as configured in the *Dimension* tab of the Layer Configuration page. Only dimensions enabled in the *Dimension* tab are available as options.
  170. Attribute to <featurecaption> mapping
  171. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  172. **List of attributes**
  173. The list allows you to read the names of the layer attributes, it doesn't really do more than that.
  174. **Feature Caption Template String**
  175. To cause an attribute to be serialized in MapML vector content as the <featurecaption> element value,
  176. you must enter its name as a ${placeholder} in the text box immediately below the attributes list. You can also add (a small amount of) plain text that will be
  177. copied verbatim into the <featurecaption> content. <featurecaption> is used as the accessible name of features by screen reader software, which will often
  178. read out this value without the user having to expand a popup; in other words, it will be used as a visual and audible tooltip when the
  179. feature is focused.
  180. MapML Resources
  181. ---------------
  182. MapML resources will be available for any published WMS layers by making a GetMap request with the WMS output format to ``format=text/mapml``. See :ref:`WMS` for further WMS details, :ref:`wms_getmap` for GetMap details, and :ref:`wms_output_formats` for output format reference information.
  183. **SRS/CRS**
  184. Note that the WMS SRS or CRS must be one of the projections supported by MapML:
  185. - MapML:WGS84 (or EPSG:4326)
  186. - MapML:OSMTILE (or EPSG:3857)
  187. - MapML:CBMTILE (or EPSG:3978)
  188. - MapML:APSTILE (or EPSG:5936)
  189. The equivalent EPSG codes are provided for reference, but the MapML names are recommended, as they
  190. imply not only a coordinate refefence system, but also a tile grid and a set of zoom levels (Tiled CRS),
  191. that the MapML client will use when operating in tiled mode. When using tiles, it's also recommended
  192. to set up tile caching for the same-named gridsets.
  193. If the native SRS of a layer is not a match for the MapML ones, remember to configure the projection
  194. policy to "reproject native to declare". You might have to save and reload the layer configuration
  195. in order to re-compute the native bounds correctly.
  196. If the SRS or CRS is not one of the above, the GetMap request will fail with an ``InvalidParameterValue`` exception.
  197. The main "MapML" link in the preview page generates a HTML client able to consume MapML resources.
  198. The link is generated so that it always work, if the CRS configured for the layer is not supported, it will automatically fall back on MapML:WGS84.
  199. **MapML Output Format**
  200. The output image format for the MapML resource should be specified using the format_options parameter with a key called ``mapml-wms-format``. If provided, the provided mime type must be a valid WMS format specifier. If not provided, it defaults to ``image/png``.
  201. Example::
  202. http://localhost:8080/geoserver/tiger/wms?service=WMS&version=1.1.0&request=GetMap&layers=tiger:giant_polygon&bbox=-180.0,-90.0,180.0,90.0&width=768&height=384&srs=EPSG:4326&styles=&format=text/mapml&format_options=mapml-wms-format:image/jpeg
  203. MapML Visualization
  204. -------------------
  205. With the MapML Extension module installed, the GeoServer Layer Preview page is modified to add a WMS GetMap link to the MapML resources for each layer or layer group. The MapML link in the Layer Preview table is generated by the MapML extension to an HTML Web map page that is created on the fly which refers to the GeoServer resource:
  206. .. figure:: images/mapml_preview_ui.png
  207. You can add layers to the map as you like, by dragging the URL bar value generated by the Layer Preview WMS formats dropdown menu selection of "MapML" as shown below, and dropping it onto another layer's MapML preview:
  208. .. figure:: images/mapml_wms_format_dropdown.png
  209. If all goes well, you should see the layers stacked on the map and in the layer control.
  210. MapML visualization is supported by the MapML.js project. The MapML viewer is built into the GeoServer layer and layer group preview facility. You can find out more about MapML.js at the project `website <https://maps4html.org/web-map-doc/>`. Here is a simple, self-contained example of an HTML page that uses the <mapml-viewer> and <layer-> elements:
  211. .. code-block:: html
  212. <!DOCTYPE html>
  213. <html lang="en">
  214. <head>
  215. <meta charset="utf-8" >
  216. <title>MapML Test Map</title>
  217. <meta name="viewport" content="width=device-width, initial-scale=1">
  218. <script type="module" src="http://localhost:8080/geoserver/mapml/viewer/widget/mapml-viewer.js"></script>
  219. <style>
  220. html, body { height: 100%; }
  221. * { margin: 0; padding: 0; }
  222. mapml-viewer:defined { max-width: 100%; width: 100%; height: 100%; }
  223. mapml-viewer:not(:defined) > * { display: none; } layer- { display: none; }
  224. </style>
  225. </head>
  226. <body>
  227. <mapml-viewer projection="osmtile" zoom="2" lat="61.209125" lon="-90.850837" controls>
  228. <layer- label="US States" src="http://localhost:8080/geoserver/mapml/topp:states/osmtile?style=population" checked></layer->
  229. </mapml-viewer>
  230. </body>
  231. </html>
  232. In the above example, the place-holders ``topp:states``, ``localhost:8080``, ``osmtile``, and ``population`` would need to be replaced with the appropriate values, and/or the ``style`` parameter could be removed entirely from the URL if not needed. You may also like to "View Source" on the preview page to see what the markup looks like for any layer. This code can be copied and pasted without harm, and you should try it and see what works and what the limitations are. For further information about MapML, and the Maps for HTML Community Group, please visit http://maps4html.org.
  233. In addition the MapML viewer is also available as output of a WFS GetFeature request. Select the ``text/html; subtype=mapml`` from the dropdown as shown below:
  234. .. figure:: images/mapml_wfs_format_dropdown.png
  235. .. warning:: Note that the MapML WFS output will automatically set a default max feature limit. Removing that limit can lead to browser issues.