TransWikia.com

Does anyone know how to make OSM national_park style using GeoServer GeoCSS?

Geographic Information Systems Asked on January 4, 2021

Does anyone know how to make OSM national_park style using GeoServer’s GeoCSS?

At the moment I’ve succeeded only using stroke-geometry: [buffer(geom, -10)], [geom];. But the result is not satisfying.

This is OSM National Park boundary style (below).
enter image description here

This is my style (below).
enter image description here

As you can see, when I zoom in, distance between original and buffered geometry increases.

Is there any better way? How to make that OSM style in proper way?

3 Answers

Assuming you want just the tiny one sided buffer you were very close,
what you were missing was the difference function:

fill-geometry: [difference(geom,buffer(geom, -200))];

This should work for you, with the distance you want.
Ian suggested you use pixels but i don't think the buffer will accept them as units,
so using multiple styles for different zoom levels is probably the best option.

##EDIT##

I tested a new style with @geowolf's answer and using a complete version to match most of the national park's style should look something like this:

* {
stroke: #00b200;
fill-opacity: 0;
stroke-opacity: 1, 0.3;
stroke-offset: 0,-5;
stroke-width: 1, 7;  }

Apart from the color which can be tinkered with, this pretty much does the job while using two symbolizers for the same line, and allows you to create the inner buffer with pixels instead of map units.

Correct answer by Dror Bogin on January 4, 2021

For reference, the style in the map you're after is found in a Mapnik Style file, located here:

https://github.com/gravitystorm/openstreetmap-carto

It might be worth trying to spin up Mapbox Studio, importing the data, applying that style, and engineering it from there.

Are you serving this up as a basemap from Geoserver, or as a dynamic layer?

Answered by DPSSpatial on January 4, 2021

Try using stroke-offset, that can be sized in pixels, e.g.:

  stroke: gray, green;
  stroke-offset: 0, 2;
  stroke-width: 1, 2;

Answered by Andrea Aime on January 4, 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