mapAnimationDownload.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. .. _community_wpsrendereddownload:
  2. Rendered map/animation download processes
  3. =========================================
  4. These processes allow download large maps and animations.
  5. The rendered download processes
  6. -------------------------------
  7. The map and animation downloads work off a set of common parameters:
  8. * ``bbox`` : a geo-referenced bounding box, controlling both output area and desired projection
  9. * ``decoration`` : the name of a decoration layout to be added on top of the map
  10. * ``decorationEnvironment`` : a valid value for the ``env`` parameter used when painting the decoration. Used for :ref:`dynamic decoration layouts<wms_dynamic_decorations>`.
  11. * ``time`` : a WMS ``time`` specification used to drive the selection of times across the layers in the map, and to control the frame generation in the animation
  12. * ``width`` and ``height`` : size of the output map/animation (and in combination with bounding box, also controls the output map scale)
  13. * ``layer``: a list of layer specifications, from a client side point of view (thus, a layer can be composed of multiple server side layers). When dwn:DecorationName layer option is used, it allows to define a specific layout that will be used when decorations are applied to the layer. It allows to render more than one Legend on the resulting image, when having more than one Layer declared.
  14. * ``headerheight`` : height size of a header space allocated at top of rendered map. It's an optional parameter, that forces to shrink the maps view height in order to avoid overlapping header over the maps. In combination with the use of layer specification options allows to group decorators at the top of resulting image.
  15. The layer specification
  16. -----------------------
  17. A layer specification is a XML structure made of three parts:
  18. * Name: a comma separated list of layer names (eventually just one)
  19. * Capabilities: link to a capabilities document (optional, used when targetting remote WMS layers)
  20. * Parameter (key, value): an extra parameter to be added in the WMS request represented by this layer (e.g., ``elevation``, ``CQL_FILTER``, ``env``)
  21. * Opacity: an optional parameter, ranging from 0 to 100, that controls the layer image level of translucency during the merge process. When not set the layer image is fully opaque. Note that this is seperate from the overall map ``transparent`` boolean parameter.
  22. For example:
  23. .. code-block:: xml
  24. <wps:ComplexData xmlns:dwn="http://geoserver.org/wps/download">
  25. <dwn:Layer>
  26. <dwn:Capabilities>http://demo.geo-solutions.it/geoserver/ows?service=wms&amp;version=1.1.1&amp;request=GetCapabilities</dwn:Name>
  27. <dwn:Name>topp:states</dwn:Name>
  28. <dwn:Parameter key="CQL_FILTER"><![CDATA[PERSONS > 1000000]]></dwn:Parameter>
  29. <dwn:Opacity>37</dwn:Opacity>
  30. </dwn:Layer>
  31. </wps:ComplexData>
  32. Decoration Layout
  33. -----------------
  34. The ``decoration`` parameter specifies the file name (without extension) of the layout to be used to decorate the map.
  35. The layout is a list of decorators that should draw on top of the requested image.
  36. The decorators draw on the image one after the other, so the order of the decorators in the layout file is important: the first decorator output will appear under the others.
  37. Decorators are described in detail in the :ref:`wms_decorations` section.
  38. It is also possible to use :ref:`dynamic decoration layouts<wms_dynamic_decorations>`, in this
  39. case the environment parameters for the decoration will be provided using ``dwn:Parameter``, e.g.:
  40. .. code-block:: xml
  41. <dwn:Layer>
  42. <dwn:Name>theLayer</dwn:Name>
  43. <dwn:DecorationName>theDynamicDecoration</dwn:DecorationName>
  44. <dwn:Parameter key="env">sla:top,right;bg:#FF0000</dwn:Parameter>
  45. </dwn:Layer>
  46. Map Download Process
  47. --------------------
  48. In addition to the common parameters, the MapDownloadProcess sports an
  49. extra boolean parameter, ``transparent``, which can be either true or false, determining if
  50. the output map has a transparent or a solid background (animation lacks this parameter, as videos
  51. need solid background). The ``transparent`` parameter defaults to ``false`` [#f1]_.
  52. Also, unlike animation, in the map download process the ``time`` parameter is optional.
  53. The map download process uses the WMS machinery to produce the output, but it's not subject to the WMS service
  54. limits (width and height in this process can be limited using the WPS process security).
  55. Sample DownloadMap requests
  56. ++++++++++++++++++++++++++++
  57. A download map issued against a set of local layers can look as follows:
  58. .. code-block:: xml
  59. <?xml version="1.0" encoding="UTF-8"?>
  60. <wps:Execute version="1.0.0" service="WPS"
  61. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0"
  62. xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0"
  63. xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml"
  64. xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1"
  65. xmlns:xlink="http://www.w3.org/1999/xlink"
  66. xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  67. <ows:Identifier>gs:DownloadMap</ows:Identifier>
  68. <wps:DataInputs>
  69. <wps:Input>
  70. <ows:Identifier>bbox</ows:Identifier>
  71. <wps:Data>
  72. <wps:BoundingBoxData crs="EPSG:4326">
  73. <ows:LowerCorner>0.237 40.562</ows:LowerCorner>
  74. <ows:UpperCorner>14.593 44.55</ows:UpperCorner>
  75. </wps:BoundingBoxData>
  76. </wps:Data>
  77. </wps:Input>
  78. <wps:Input>
  79. <ows:Identifier>time</ows:Identifier>
  80. <wps:Data>
  81. <wps:LiteralData>2008-10-31T00:00:00.000Z</wps:LiteralData>
  82. </wps:Data>
  83. </wps:Input>
  84. <wps:Input>
  85. <ows:Identifier>width</ows:Identifier>
  86. <wps:Data>
  87. <wps:LiteralData>200</wps:LiteralData>
  88. </wps:Data>
  89. </wps:Input>
  90. <wps:Input>
  91. <ows:Identifier>height</ows:Identifier>
  92. <wps:Data>
  93. <wps:LiteralData>80</wps:LiteralData>
  94. </wps:Data>
  95. </wps:Input>
  96. <wps:Input>
  97. <ows:Identifier>layer</ows:Identifier>
  98. <wps:Data>
  99. <wps:ComplexData xmlns:dwn="http://geoserver.org/wps/download">
  100. <dwn:Layer>
  101. <dwn:Name>giantPolygon</dwn:Name>
  102. <dwn:Parameter key="featureId">giantPolygon.0</dwn:Parameter>
  103. </dwn:Layer>
  104. </wps:ComplexData>
  105. </wps:Data>
  106. </wps:Input>
  107. <wps:Input>
  108. <ows:Identifier>layer</ows:Identifier>
  109. <wps:Data>
  110. <wps:ComplexData xmlns:dwn="http://geoserver.org/wps/download">
  111. <dwn:Layer>
  112. <dwn:Name>watertemp</dwn:Name>
  113. </dwn:Layer>
  114. </wps:ComplexData>
  115. </wps:Data>
  116. </wps:Input>
  117. </wps:DataInputs>
  118. <wps:ResponseForm>
  119. <wps:RawDataOutput mimeType="image/png">
  120. <ows:Identifier>result</ows:Identifier>
  121. </wps:RawDataOutput>
  122. </wps:ResponseForm>
  123. </wps:Execute>
  124. For this example the layers could have been a single one, with a "Name" equal to "giantPolygon,watertermp".
  125. Secondary output: map metadata
  126. ++++++++++++++++++++++++++++++
  127. The process offers also a secondary output, called ``metadata``, which can be used to determine
  128. if there were any issue related to the requested times. The warnings are issued when the layer
  129. has a "nearest match" behavior activated, with an eventual search range.
  130. In case the requested time could not be matched exactly, a warning will be issued that might contain:
  131. - An indication that a nearby time has been used, and which time that is.
  132. - An indication that no time was found, that was sufficiently close to the requested one, according
  133. to the search range specification in the layer "nearest match" configuration.
  134. In order to get both outputs, the following response form is recommended, which requires
  135. a reference (a link) for the map, while the warnings are included inline:
  136. .. code-block:: xml
  137. <?xml version="1.0" encoding="UTF-8"?>
  138. <wps:Execute version="1.0.0" service="WPS"
  139. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0"
  140. xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0"
  141. xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml"
  142. xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1"
  143. xmlns:xlink="http://www.w3.org/1999/xlink"
  144. xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  145. <ows:Identifier>gs:DownloadMap</ows:Identifier>
  146. <!-- Inputs section removed for brevity -->
  147. <wps:ResponseForm>
  148. <wps:ResponseDocument>
  149. <wps:Output asReference="true">
  150. <ows:Identifier>result</ows:Identifier>
  151. </wps:Output>
  152. <wps:Output>
  153. <ows:Identifier>metadata</ows:Identifier>
  154. </wps:Output>
  155. </wps:ResponseDocument>
  156. </wps:ResponseForm>
  157. </wps:Execute>
  158. A sample response, reporting warnings, follows:
  159. .. code-block:: xml
  160. <?xml version="1.0" encoding="UTF-8"?><wps:ExecuteResponse xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" service="WPS" serviceInstance="http://localhost:8080/geoserver/ows?" version="1.0.0" xml:lang="en">
  161. <wps:Process wps:processVersion="1.0.0">
  162. <ows:Identifier>gs:DownloadMap</ows:Identifier>
  163. <ows:Title>Map Download Process</ows:Title>
  164. <ows:Abstract>Builds a large map given a set of layer definitions, area of interest, size and eventual target time.</ows:Abstract>
  165. </wps:Process>
  166. <wps:Status creationTime="2021-06-07T16:50:47.391Z">
  167. <wps:ProcessSucceeded>Process succeeded.</wps:ProcessSucceeded>
  168. </wps:Status>
  169. <wps:ProcessOutputs>
  170. <wps:Output>
  171. <ows:Identifier>result</ows:Identifier>
  172. <ows:Title>The output map</ows:Title>
  173. <wps:Reference href="http://localhost:8080/geoserver/ows?service=WPS&amp;version=1.0.0&amp;request=GetExecutionResult&amp;executionId=5db686ed-8591-4756-8651-4bd26281bf37&amp;outputId=result.png&amp;mimetype=image%2Fpng" mimeType="image/png"/>
  174. </wps:Output>
  175. <wps:Output>
  176. <ows:Identifier>metadata</ows:Identifier>
  177. <ows:Title>map metadata, including dimension match warnings</ows:Title>
  178. <wps:Data>
  179. <wps:ComplexData mimeType="text/xml">
  180. <DownloadMetadata>
  181. <Warnings>
  182. <DimensionWarning>
  183. <LayerName>sf:bmtime</LayerName>
  184. <DimensionName>time</DimensionName>
  185. <Value class="Date">2004-02-01T00:00:00.000Z</Value>
  186. <WarningType>Nearest</WarningType>
  187. </DimensionWarning>
  188. </Warnings>
  189. <WarningsFound>true</WarningsFound>
  190. </DownloadMetadata>
  191. </wps:ComplexData>
  192. </wps:Data>
  193. </wps:Output>
  194. </wps:ProcessOutputs>
  195. </wps:ExecuteResponse>
  196. Animation Download Process
  197. --------------------------
  198. The download animation has all the basic parameters with the following variants/additions:
  199. * time: The time parameter is required and can be provided either as range with periodicity, ``start/stop/period``, or
  200. as a comma separated list of times,``t1,t2,...,tn``
  201. * fps: Frame per seconds (defaults to one)
  202. Sample DownloadAnimation request
  203. ++++++++++++++++++++++++++++++++
  204. A sample animation request can look as follows:
  205. .. code-block:: xml
  206. <?xml version="1.0" encoding="UTF-8"?>
  207. <wps:Execute version="1.0.0" service="WPS"
  208. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0"
  209. xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0"
  210. xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml"
  211. xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1"
  212. xmlns:xlink="http://www.w3.org/1999/xlink"
  213. xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  214. <ows:Identifier>gs:DownloadAnimation</ows:Identifier>
  215. <wps:DataInputs>
  216. <wps:Input>
  217. <ows:Identifier>bbox</ows:Identifier>
  218. <wps:Data>
  219. <wps:BoundingBoxData crs="EPSG:4326">
  220. <ows:LowerCorner>-180 -90</ows:LowerCorner>
  221. <ows:UpperCorner>180 90</ows:UpperCorner>
  222. </wps:BoundingBoxData>
  223. </wps:Data>
  224. </wps:Input>
  225. <wps:Input>
  226. <ows:Identifier>decoration</ows:Identifier>
  227. <wps:Data>
  228. <wps:LiteralData>formattedTimestamper</wps:LiteralData>
  229. </wps:Data>
  230. </wps:Input>
  231. <wps:Input>
  232. <ows:Identifier>time</ows:Identifier>
  233. <wps:Data>
  234. <wps:LiteralData>2004-02-01,2004-03-01,2004-04-01,2004-05-01</wps:LiteralData>
  235. </wps:Data>
  236. </wps:Input>
  237. <wps:Input>
  238. <ows:Identifier>width</ows:Identifier>
  239. <wps:Data>
  240. <wps:LiteralData>271</wps:LiteralData>
  241. </wps:Data>
  242. </wps:Input>
  243. <wps:Input>
  244. <ows:Identifier>height</ows:Identifier>
  245. <wps:Data>
  246. <wps:LiteralData>136</wps:LiteralData>
  247. </wps:Data>
  248. </wps:Input>
  249. <wps:Input>
  250. <ows:Identifier>fps</ows:Identifier>
  251. <wps:Data>
  252. <wps:LiteralData>0.5</wps:LiteralData>
  253. </wps:Data>
  254. </wps:Input>
  255. <wps:Input>
  256. <ows:Identifier>layer</ows:Identifier>
  257. <wps:Data>
  258. <wps:ComplexData xmlns:dwn="http://geoserver.org/wps/download">
  259. <dwn:Layer>
  260. <dwn:Name>sf:bmtime</dwn:Name>
  261. </dwn:Layer>
  262. </wps:ComplexData>
  263. </wps:Data>
  264. </wps:Input>
  265. </wps:DataInputs>
  266. <wps:ResponseForm>
  267. <wps:RawDataOutput mimeType="video/mp4">
  268. <ows:Identifier>result</ows:Identifier>
  269. </wps:RawDataOutput>
  270. </wps:ResponseForm>
  271. </wps:Execute>
  272. The ``formattedTimestamper`` decoration ensures the frame time is included in the output animation, and looks as follows:
  273. .. code-block:: xml
  274. <layout>
  275. <decoration type="text" affinity="bottom,right" offset="6,6" size="auto">
  276. <option name="message"><![CDATA[
  277. <#setting datetime_format="yyyy-MM-dd'T'HH:mm:ss.SSSX">
  278. <#setting locale="en_US">
  279. <#if time??>
  280. ${time?datetime?string["dd-MM-yyyy"]}
  281. </#if>]]></option>
  282. <option name="font-family" value="Bitstream Vera Sans"/>
  283. <option name="font-size" value="12"/>
  284. <option name="halo-radius" value="2"/>
  285. </decoration>
  286. </layout>
  287. Secondary output: animation metadata
  288. ++++++++++++++++++++++++++++++++++++
  289. The process offers also a secondary output, called ``metadata``, which can be used to determine
  290. if there were any issue related to the requested times. The warnings are issued when the layer
  291. has a "nearest match" behavior activated, with an eventual search range.
  292. In case the requested time could not be matched exactly, a warning will be issued that might contain:
  293. - An indication that a nearby time has been used, and which time that is.
  294. - An indication that no time was found, that was sufficiently close to the requested one, according
  295. to the search range specification in the layer "nearest match" configuration.
  296. In order to get both outputs, the following response form is recommended, which requires
  297. a reference (a link) for the animation, while the warnings are included inline:
  298. .. code-block:: xml
  299. <?xml version="1.0" encoding="UTF-8"?>
  300. <wps:Execute version="1.0.0" service="WPS"
  301. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0"
  302. xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0"
  303. xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml"
  304. xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1"
  305. xmlns:xlink="http://www.w3.org/1999/xlink"
  306. xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  307. <ows:Identifier>gs:DownloadAnimation</ows:Identifier>
  308. <!-- Inputs section removed for brevity -->
  309. <wps:ResponseForm>
  310. <wps:ResponseDocument>
  311. <wps:Output asReference="true">
  312. <ows:Identifier>result</ows:Identifier>
  313. </wps:Output>
  314. <wps:Output>
  315. <ows:Identifier>metadata</ows:Identifier>
  316. </wps:Output>
  317. </wps:ResponseDocument>
  318. </wps:ResponseForm>
  319. </wps:Execute>
  320. A sample response, reporting warnings and the frame count where they happened, follows:
  321. .. code-block:: xml
  322. <?xml version="1.0" encoding="UTF-8"?><wps:ExecuteResponse xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" service="WPS" serviceInstance="http://localhost:8080/geoserver/ows?" version="1.0.0" xml:lang="en">
  323. <wps:Process wps:processVersion="1.0.0">
  324. <ows:Identifier>gs:DownloadAnimation</ows:Identifier>
  325. <ows:Title>Animation Download Process</ows:Title>
  326. <ows:Abstract>Builds an animation given a set of layer definitions, area of interest, size and a series of times for animation frames.</ows:Abstract>
  327. </wps:Process>
  328. <wps:Status creationTime="2021-06-07T16:50:47.391Z">
  329. <wps:ProcessSucceeded>Process succeeded.</wps:ProcessSucceeded>
  330. </wps:Status>
  331. <wps:ProcessOutputs>
  332. <wps:Output>
  333. <ows:Identifier>result</ows:Identifier>
  334. <ows:Title>The animation</ows:Title>
  335. <wps:Reference href="http://localhost:8080/geoserver/ows?service=WPS&amp;version=1.0.0&amp;request=GetExecutionResult&amp;executionId=b98eded5-8122-442b-a6c7-87a872779153&amp;outputId=result.mp4&amp;mimetype=video%2Fmp4" mimeType="video/mp4"/>
  336. </wps:Output>
  337. <wps:Output>
  338. <ows:Identifier>metadata</ows:Identifier>
  339. <ows:Title>Animation metadata, including dimension match warnings</ows:Title>
  340. <wps:Data>
  341. <wps:ComplexData mimeType="text/xml">
  342. <AnimationMetadata>
  343. <Warnings>
  344. <FrameWarning>
  345. <LayerName>sf:bmtime</LayerName>
  346. <DimensionName>time</DimensionName>
  347. <Value class="Date">2004-02-01T00:00:00.000Z</Value>
  348. <WarningType>Nearest</WarningType>
  349. <Frame>0</Frame>
  350. </FrameWarning>
  351. <FrameWarning>
  352. <LayerName>sf:bmtime</LayerName>
  353. <DimensionName>time</DimensionName>
  354. <WarningType>FailedNearest</WarningType>
  355. <Frame>1</Frame>
  356. </FrameWarning>
  357. <FrameWarning>
  358. <LayerName>sf:bmtime</LayerName>
  359. <DimensionName>time</DimensionName>
  360. <Value class="Date">2004-04-01T00:00:00.000Z</Value>
  361. <WarningType>Nearest</WarningType>
  362. <Frame>2</Frame>
  363. </FrameWarning>
  364. <FrameWarning>
  365. <LayerName>sf:bmtime</LayerName>
  366. <DimensionName>time</DimensionName>
  367. <Value class="Date">2004-05-01T00:00:00.000Z</Value>
  368. <WarningType>Nearest</WarningType>
  369. <Frame>3</Frame>
  370. </FrameWarning>
  371. </Warnings>
  372. <WarningsFound>true</WarningsFound>
  373. </AnimationMetadata>
  374. </wps:ComplexData>
  375. </wps:Data>
  376. </wps:Output>
  377. </wps:ProcessOutputs>
  378. </wps:ExecuteResponse>
  379. In the above output, frames 0, 2 and 3 were nearest matched to an available time, being specified
  380. in the ``Value`` field, while the time requested for frame number 1 was too far away from any
  381. available time, resulting in a ``NearestFail``. The frame is still present in the animation, but
  382. will likely be blank.
  383. In case multiple time based layers are requested in the animation, there might be multiple warnings
  384. for each frame.
  385. .. rubric:: Footnotes
  386. .. [#f1] The default value of ``transparent`` can be flipped using a system variable, e.g. ``-DDOWNLOAD_MAP_TRANSPARENT=true``