-
Notifications
You must be signed in to change notification settings - Fork 819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PolygonPatternSymbolizer metatile alignment #937
Comments
A power of two, right? |
Ah, fixed. |
Currently all patterns are very regular with small tile size, most with a square cartesian grid. The most randomized are probably scrub and wetland. The question is if this is a deliberate design decision intended to be kept or if a more randomized pattern would actually be preferred. It is quite easily possible to generate a randomized power-of-two-periodic pattern and with the current symbol sizes and distances and this would mostly work well with a tile size limit of 256 pixel. Here a quick demo for the forest symbol (just a rough imitation, not really an exact reproduction): A randomized pattern of course requires a relatively large tile size to look good - 256 pixel is already quite the minimum in this case. This might have performance implications. |
I'd like to keep switching to a randomized pattern as a separate issue. |
Updated the list. |
This adds a random symbology for forests, lightens forests, and unifies natural=wood and landuse=forest rendering. Using http://www.imagico.de/map/jsdotpattern.php a random pattern was generated from the SVG <path d="m 3.5,0 -3.5,3.5 0,0.5 0.5,0 2.5,-2.5 0,2 -3,3 0,0.5 0.5,0 2.5,-2.5 0,5.5 1,0 0,-5.5 2.5,2.5 0.5,0 0,-0.5 -3,-3 0,-2 2.5,2.5 0.5,0 0,-0.5 z" fill="rgb(58,135,39)"/> <path d="m 10.5,0 a 2.5,3 0 0,1 0,6 l 0,-1 a 1.5,2 0 0,0 0,-4 a 1.5,2 0 0,0 0,4 l 0,1 a 2.5,3 0 0,1 0,-6 z" fill="rgb(58,135,39)"/> This was then converted with GIMP into a PNG which Mapnik can use. The forest fill was lightened, but there are now darker symbols on. This necessitated adjusting the text colour for forests, which was done in Lch colour space. The frequent symbols also required some halo adjustments. There are multiple interpretations in use of landuse=forest vs. natural=wood. Rather than attempt to sort this out when the tagging has not settled, the same appearance is used for both. This commit doesn't use different symbologies for different types of forests (mixed/coniferous/broad_leaved/palm) (gravitystorm#822), but that can be considered later. Fixes gravitystorm#938 Fixes forest part of gravitystorm#937
This adds a random symbology for forests, lightens forests, and unifies natural=wood and landuse=forest rendering. Using http://www.imagico.de/map/jsdotpattern.php a random pattern was generated from the SVG <path d="m 3.5,0 -3.5,3.5 0,0.5 0.5,0 2.5,-2.5 0,2 -3,3 0,0.5 0.5,0 2.5,-2.5 0,5.5 1,0 0,-5.5 2.5,2.5 0.5,0 0,-0.5 -3,-3 0,-2 2.5,2.5 0.5,0 0,-0.5 z" fill="rgb(58,135,39)"/> <path d="m 10.5,0 a 2.5,3 0 0,1 0,6 l 0,-1 a 1.5,2 0 0,0 0,-4 a 1.5,2 0 0,0 0,4 l 0,1 a 2.5,3 0 0,1 0,-6 z" fill="rgb(58,135,39)"/> This was then converted with GIMP into a PNG which Mapnik can use. The forest fill was lightened, but there are now darker symbols on. This necessitated adjusting the text colour for forests, which was done in Lch colour space. The frequent symbols also required some halo adjustments. There are multiple interpretations in use of landuse=forest vs. natural=wood. Rather than attempt to sort this out when the tagging has not settled, the same appearance is used for both. This commit doesn't use different symbologies for different types of forests (mixed/coniferous/broad_leaved/palm) (gravitystorm#822), but that can be considered later. Fixes gravitystorm#938 Fixes forest part of gravitystorm#937 Closes #6
Updated, including a minor shell script change. |
Updated |
Updated, we're close |
We have the last one which is still not power of two:
but we have more above 256 px:
Why would they be a problem? |
Because they won't align when rendering tile by tile |
Should we recreate them all in 256 px then? |
They also won't align with some metatiling systems when taking into account buffer.
Yes. |
SVG polygon pattern files currently > 256 px: quarry.svg All others are ≤ 256 px and a power of 2. |
For all of these there were good reasons to make them 512 pixel in size (as well as for the wetland patterns which are also 512 pixel). In case of relaxed random patterns there are the following requirements for a good quality irregular pattern:
This does not mean you cannot create a decent random pattern with 256 pixel size for scrub and forest but it is significantly more difficult. |
With #2739 being merged now, and all the others being deliberately 512 px, I guess we can close this issue. |
Are we sure we're not running into any issues in production or with Kosmtik with the 512px patterns? |
I would assume that through openstreetmap-carto/project.mml Line 2 in 9cdab72
we define a minimum metatile size of 512 pixel. But if there are reasons to allow 256 pixel metatiles this would of course be possible. There would be some constraints design wise - see above - but it would be manageable. |
Is the origin of the pattern at the edge of the rendering, or the edge of the metatile? I don't know the answer to this, and I wouldn't assume everything is the same. |
In a tiled rendering the edge of the metatile is also the edge of the rendering (at least from the point of view of mapnik).
|
No, things are buffered beyond the metatile. |
Ok, but then the alignment appears to be independent of the buffer - both in kosmtik and on the OSMF servers. |
sent from a phone
On 12. Aug 2017, at 07:00, Paul Norman ***@***.***> wrote:
They also won't align with some metatiling systems when taking into account buffer.
I'd consider it a bug if adding a buffer would change pattern alignment/start.
|
Related to what @sommerluk told in #2748 (comment) - there's a need to decide how do we want to go on with patterns currently? We can leave the things as they are and suspend changes for some time, but even such solution needs a deadline and decision at the end - no matter if we know all the side effects of tiling, because patterns are important tool we use. |
Looks like the Mapnik solution is getting ready - mapnik/mapnik#3989 is merged now, next thing would be 3.0.x port and release. |
The Mapnik solution will bring us true global alignment of pattern, so we could use even pattern with arbitrary size (113 × 113 or whatever), which is really great. An open pull request for the backport is at mapnik/mapnik#4005 |
True global alignment is part of Mapnik 3.0.22 release. Should this issue be closed now? |
Closing this issue. This has been fixed at the Mapnik side and also backported to the 3.0.x series. Now I’ve verified this with python-mapnik 3.0.22, and it works correctly. (However, the current node-mapnik still hasn’t this fix, but I think it will be part of the next release.) Note that currently we do not require Mapnik 3.0.22 in our INSTALLmd, so we can only rely on this feature if we also bump our requiered Mapnik version to at least 3.0.22. |
To use polygon pattern, the pattern either needs to fit into fit into a metatile an integer number of times with
polygon-pattern-alignment: global
or havepolygon-clip: false
, or artifacts at meta-tile boundaries will occur.Without a fixed metatile size, this implies both pattern dimensions should be a multiple of two, and at most 256.
Because the defaults used to be
polygon-clip: false
, many of the icons do not meet this criteria. We need to check if there is more performance frompolygon-clip: false
, and if so, set that, otherwise, change the PNGs.Some shell scripting (
./node_modules/.bin/carto -a 3.0.12 project.mml | grep PolygonPatternSymbolizer | sed 's| <PolygonPatternSymbolizer [^>]*file="\([^"]*\)".*/>|\1|' | sort -u | xargs pnginfo | grep -B1 'Image Width'
) lets us get the image sizes.The following files are not powers of two
The text was updated successfully, but these errors were encountered: