options.rst 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. .. _vectortiles.options:
  2. Vector Tiles Generation Options
  3. -------------------------------
  4. The content of the vector tiles generated by this output format is driven by the
  5. style used in the GetMap/GetTile request.
  6. The style can be pretty basic. The vector tile output format considers only the following:
  7. * Rules scale denominators and the rule filters control which features are included in the output
  8. (e.g., in a road layer, one can include only highways at low zoom levels)
  9. * Feature type style and rule vendor options can provide more fine grained control over the output.
  10. Inclusion of options in the rule is recommended only when trying to apply the options in a scale dependent way.
  11. In particular, the following vendor options can be included:
  12. .. list-table::
  13. :widths: 20 80
  14. :header-rows: 1
  15. * - Option
  16. - Description
  17. * - vt-attributes
  18. - A comma separated list of attributes to be included in the output. Reducing the number of attributes helps control the tile size.
  19. * - vt-coalesce
  20. - ``true``/``false``, enables feature geometry merging when attribute values are equal. This can greatly reduce the tile size, especially when coupled with a small attribute list, which helps in finding more attribute duplicates. To perform duplicate detection, the code will run a ‘sort’ on the attributes. If the source is a database, it is best to keep the indexed ones first in the list.
  21. * - vt-labels
  22. - ``true``/``false``, enable the generation of a sidecar "<layerName>-labels" layer with label points. Meant to be used only for polygon geometries, as vector tile clients often lack the ability to compute a suitable label point.
  23. * - vt-label-attributes
  24. - A comma-separated list of attributes to include in the label layer. Typically, only the attributes needed to create the label will be included. Features will be generated only if at least one of the attribute values is not null, meaning there is a chance of creating a label.
  25. The following SLD style, meant to be used as a "style group", demonstrates the conceptes above:
  26. .. code-block:: xml
  27. <?xml version="1.0" encoding="UTF-8"?><sld:StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld" xmlns="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0">
  28. <sld:NamedLayer>
  29. <sld:Name>tiger:poly_landmarks</sld:Name>
  30. <sld:UserStyle>
  31. <sld:Name>Default style</sld:Name>
  32. <sld:IsDefault>1</sld:IsDefault>
  33. <sld:FeatureTypeStyle>
  34. <sld:Rule>
  35. <sld:PolygonSymbolizer>
  36. <sld:Fill/>
  37. </sld:PolygonSymbolizer>
  38. </sld:Rule>
  39. <sld:VendorOption name="vt-coalesce">false</sld:VendorOption>
  40. <sld:VendorOption name="vt-attributes">CFCC</sld:VendorOption>
  41. <sld:VendorOption name="vt-labels">true</sld:VendorOption>
  42. <sld:VendorOption name="vt-label-attributes">LANAME</sld:VendorOption>
  43. </sld:FeatureTypeStyle>
  44. </sld:UserStyle>
  45. </sld:NamedLayer>
  46. <sld:NamedLayer>
  47. <sld:Name>tiger:tiger_roads</sld:Name>
  48. <sld:UserStyle>
  49. <sld:Name>Default style</sld:Name>
  50. <sld:IsDefault>1</sld:IsDefault>
  51. <sld:FeatureTypeStyle>
  52. <sld:Rule>
  53. <sld:MaxScaleDenominator>270000</sld:MaxScaleDenominator>
  54. <sld:LineSymbolizer>
  55. <sld:Stroke/>
  56. </sld:LineSymbolizer>
  57. </sld:Rule>
  58. <sld:VendorOption name="vt-coalesce">false</sld:VendorOption>
  59. <sld:VendorOption name="vt-attributes">NAME</sld:VendorOption>
  60. </sld:FeatureTypeStyle>
  61. </sld:UserStyle>
  62. </sld:NamedLayer>
  63. <sld:NamedLayer>
  64. <sld:Name>tiger:poi</sld:Name>
  65. <sld:UserStyle>
  66. <sld:Name>Default style</sld:Name>
  67. <sld:IsDefault>1</sld:IsDefault>
  68. <sld:FeatureTypeStyle>
  69. <sld:Rule>
  70. <sld:MaxScaleDenominator>135000</sld:MaxScaleDenominator>
  71. <sld:PointSymbolizer>
  72. <sld:Graphic>
  73. <sld:Mark>
  74. <sld:Fill/>
  75. </sld:Mark>
  76. </sld:Graphic>
  77. </sld:PointSymbolizer>
  78. </sld:Rule>
  79. </sld:FeatureTypeStyle>
  80. </sld:UserStyle>
  81. </sld:NamedLayer>
  82. </sld:StyledLayerDescriptor>
  83. Describing the salient bits:
  84. * ``tiger_roads`` and ``poi`` are scale dependent, they won't be available in zoomed out tiles
  85. * ``poly_landmarks`` only reports CFCC and enables polygon coaleshing, allowing to merge a few polygons with the same class
  86. * ``poly_landmarks`` also enables a separate label layer with polygon label points (``poly_landmarks-labels``), with only the NAME attribute
  87. * ``tiger-roads`` selects the attributes for labelling, and enables coaleshing, which helps a lot reducing the tile size, since each roads
  88. is split amongs many smaller features (at intersections).
  89. * The usage of feature coaleshing reduces the size of vector tiles by around 50%, compared to simple attribute selection, in this case.
  90. Layers with more/more complex attributes will benefit more.