optimize.rst 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. .. _community_solr_optimize:
  2. Optimize rendering of complex polygons
  3. --------------------------------------
  4. Rendering large maps with complex polygons, to show the overall distribution of the data, can
  5. take a significant toll, especially if GeoServer cannot connect to the SOLR server via a high
  6. speed network.
  7. A common approach to handle this issue is to add a second geometry to the SOLR documents,
  8. representing the centroid of the polygon, and using that one to render the features when
  9. fairly zoomed out.
  10. Once the SOLR documents have been updated with a centroid column, and it has been populated,
  11. the column can be added as a secondary geometry. Make sure to keep the polygonal geometry
  12. as the default one:
  13. .. figure:: images/optimize_ft1.png
  14. :align: center
  15. ... (other fields omitted)
  16. .. figure:: images/optimize_ft2.png
  17. :align: center
  18. *Configuring a layer with multiple geometries*
  19. With this setup the polygonal geometry will still be used for all spatial filters, and for
  20. rendering, unless the style otherwise specifical demands for the centroid.
  21. Then, a style with scale dependencies can be setup in order to fetch only then centroids
  22. when fairly zoomed out, like in the following CSS example: ::
  23. [@scale > 50000] {
  24. geometry: [centroid];
  25. mark: symbol(square);
  26. }
  27. :mark {
  28. fill: red;
  29. size: 3;
  30. }​
  31. [@scale <= 50000] {
  32. fill: red;
  33. stroke: black;
  34. }
  35. Using this style the ``spatial`` field will still be used to resolve the BBOX filter implicit
  36. in the WMS requests, but only the much smaller ``centroid`` one will be transferred to GeoServer
  37. for rendering.