TransWikia.com

GeoServer cutting off symbols close to tile edges?

Geographic Information Systems Asked by Ashutosh Agrawal on March 8, 2021

When I use specific icons for point display using GeoServer, several icons are cropped automatically. This is may be because of tile size or else.

How can I resolve this?

enter image description here

4 Answers

Generally, you have 3 options:

You may disable tiling altogether, which will probably get rid of most symbols being cut off (except maybe at the bounding box edges?) but it will obviously make rendering times increase, so I wouldn't recommend it.

You may want to look into metatiling, which effectively combines multiple tiles adjacent to the current tile prior to rendering symbology and then transforms them back into the original tile size. GeoServer's WMS supports metatiling as a vendor parameter, but is subject to the restriction that the tile size must be 256x256 pixels. I would reccomend using GeoWebCache instead, as it has more metatiling options and is more flexible in this regard.

GeoWebCache also offers a gutter parameter, which adds extra pixel padding space around each tile. This also helps with eliminating artifacts near tile edges, and can be combined with metatiling to prevent said artifacts.

See https://docs.geoserver.org/stable/en/user/geowebcache/webadmin/defaults.html#default-metatile-size for info on metatiling and gutters.

Related: GeoServer VendorOption for SLD to place labels overlapping and out of bounds

Correct answer by benjwadams on March 8, 2021

I had the same issue with the cropped icons. The solution which worked on my side was using GeoWebCache and adding extra transparent space around every icon. For the icon size 24x24px was added 12px around the icon.

Answered by Luboš Müller on March 8, 2021

(Maybe this is not a correct answer, as the question is about icons of points; but hopefully someone can use it.)

Additionally to the gutter mentioned in the answer I used the following approach to label lines using a TextSymolizer with a Graphic (and solve the problem of symbols being clipped at tile edges):

<TextSymbolizer>
  <!-- ... -->
  <Graphic>
    <ExternalGraphic>
      <OnlineResource xlink:type="simple" xlink:href="http://localhost:8080/geoserver/styles/icons/${code}.png"/>
      <Format>image/png</Format>
    </ExternalGraphic>
    <Size>25</Size>
    <Rotation>0</Rotation>
  </Graphic>
  <Priority>100000</Priority>
  <VendorOption name="spaceAround">13</VendorOption>
  <VendorOption name="group">no</VendorOption>
  <VendorOption name="repeat">300</VendorOption>
  <VendorOption name="partials">true</VendorOption>
</TextSymbolizer>

This creates a icon of 25pixel height/width as a label of a line using the attribute/property code of the feature served by GeoServer (2.7 in my case), with a spaceAround of a little more than half the icons size and no grouping.

The <VendorOption name="partials">true</VendorOption> tells GeoServer to draw only one label (no matter how many tiles are needed to display the feature). (Note that this is very similar to a <PointSymbolizer> instead of a <TextSymbolizer>, but for a curved line the label is placed directly on the line and not on the centroid of the line, which may be aside of the line.) And <VendorOption name="repeat">300</VendorOption> then does almost the same as if you do not use partials (default is false), as the icons is drawn on every tile, but in conjunction with partials=true the icon is repeated every 300 pixels (at little more than a default tile of 256 ) without any clippings of icons at tile borders.

Answered by bkiselka on March 8, 2021

I had the same issue and the solution that worked for me was this one: https://gis.stackexchange.com/a/198663/93019

I increased the buffer parameter in WMS.

Answered by Meyra on March 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP