-
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
Uniformize swamp rendering with forest/wood #3051
Conversation
Thanks @imagico for the pattern
Great, I hope I will test it soon! Two general questions:
You don't have to squeeze the commits, because maintainers can do it easily now while merging. |
Well, I merely added the images @imagico made, so I'm unsure about your questions, but, naively, I would say:
|
I meant how did you combine them if this is not already documented. OK, so let just remove the old image if not needed (I guess it was used only for producing swamp image). |
Assembling the pattern image is explained on The change in symbol can be done on the SVG level, no need to re-generate the base pattern. |
OK, that's what I suspected. Any other comments or is it OK for you? |
Do you mean producing SVG image (or what else)? |
I meant replacing the symbol in the SVG code in https://raw.githubusercontent.com/gravitystorm/openstreetmap-carto/master/symbols/generating_patterns/swamp.svg with a different symbol. |
@Penegal Do you plan to fix this? |
Don't read this with an ironic tone, it is not my intent: as you 2 were talking on your own, I thought you were no longer waiting my contribution. I'll try, then, once I will have found the necessary symbols and the parameters of your pattern generation code. |
Upon reflection, I don't understand how I can use the pattern generation code with 2 symbols; the .md file for wetland doesn't help, as it describes the generation of a bitmap using ImageMagick, not a SVG. I could create the SVG myself, but there must be some semi-automated way to do it, isn't it? |
The description in describes in a generic way how to produce the composite wetland patterns from the generic wetland svg and the specific pattern svg (named https://raw.githubusercontent.com/gravitystorm/openstreetmap-carto/master/symbols/generating_patterns/swamp.svg and the two colors This will allow you to re-create the current swamp png from the svg files. To generate a new pattern with different symbols you do the same - but with a different |
We have the open, public discussions here and this is very typical to nitpick all the details from all the possible points of view before merging. Not only your contribution is welcome, but also it looks like quite close to being accepted. |
@imagico: I followed the instructions, retrieved the colors from already existing patterns and used There must be something I'm missing here: AFAIK, Now, I could ask someone else to do it, but, now I'm on it, I would like to be able to understand and complete the task, as asking somebody else won't learn me anything. @kocio-pl: OK, thanks for the note. |
The wetland patterns are generated as PNG. You could try implementing a similar process on SVG level but given the limited scripting abilities of Inkscape and the lack of any other tools that allow similar processing in an automated fashion makes this difficult. And considering Mapnik's SVG pattern rendering is broken the practical usefulness of this would be rather limited. |
Oh, I think I see my error: I thought I had to generate the whole swamp pattern in SVG, but only had to regenerate Could it be OK to simly use this 256256 px pattern 4 times to generate the 512512 px |
The 512x512 pixel pattern size for wetlands was chosen because of the difficulty of creating a proper random relaxed pattern of this density at a smaller size. Apart from that there is no reason why you cannot use a pattern of 256x256 pixel. |
Then I'll try to create the 512*512 px manually. |
Please have a look at the files, looks like something is wrong with both images - right and bottom parts have unexpected margin space with no tree pattern. |
Wow, I missed that! Strange… I'll check it; thanks for noticing. |
It also looks like |
That must be from the interpolation used when doubling the resolution, because I did nothing else. |
Could you try the same procedure with current versions to see if this problem will appear? |
@Penegal What is current state of this code, do you think you can fix it? |
Kept that in mind but had no time to correct; I'll try to fix it in the next days. |
Is there someone with ImageMagick knowledge who could say why the first Edit: I can get round it by manually resizing Because the same problem arises at two different points of the process, and with two different pixel counts, there seems to be two problems in the command sequence in https://github.com/gravitystorm/openstreetmap-carto/blob/master/symbols/generating_patterns/wetland.md As I use the ImageMagick version supplied with Debian 9 stable, it is likely that I'm not the only one affected by this bug, so it could be very useful that someone with good knowledge of ImageMagick take a look at this problem to help me solve it. |
@imagico: if I understand correctly, your Inkscape calls only replace the If your configuration allows you to correctly generate the patterns, would you simply generate them and then you or I would include them in the PR and that's all? We wouldn't get the cause of these bugs, but they would have been circumvented and the new patterns could be put in production. This PR has been opened months ago, and you seem the only one to be able to generate the patterns correctly. Would you generate them? |
Of course i can generate a pattern image for this but for the goal of adaptability and maintainability there should be a working process to create those to allow people adjusting the pattern - like for using different symbols or a different color. I would gladly help you tracking down the problem you have but since i can't reproduce it i cannot really do much about it actively. A useful starting point could be to run the pattern image generation on the alternative-colors style and see what the results are. Do they differ between using Imagemagick or Inkscape? Are all patterns produced incorrectly or just some? Another starting point would be to open the pattern SVG in Inkscape interactively and then try to export it as PNG. Does it correctly export the image then? With the right extent and the right size? The inkscape command should generate the same as you get when you interactively export the image from inkscape. |
Well, I think I found something explaining the downsizing of Regarding the Edit: what's the matter with density anyway? It seems that the sequence of commands only take care of pixel size, not physical size; if so, we could just let imagemagick take care of density and see what happens. I'll also try that. |
I also tried to upgrade |
As i have written above in #3051 (comment) for the wetland pattern process you need both the native resolution version and one with eight times the linear resolution for the casing processing. If rasterization for you without a specified resolution leads to an incorrect output resolution that is a bug in the program in the version used (presumably resulting in use of a different assumed resolution for converting SVG dimensionless units into real world units and converting back into pixel). But since both imagemagick and inkscape allow specifying an output resolution you can compensate for that. So you'd need to rasterize once at a resolution that matches the assumed resolution for converting between pixel and real world units and another time at eight times that resolution (which would be 768 ppi if the assumed native resolution is 96 ppi as you indicate) for the casing which is after processing scaled back to 12.5% which is the same size again. |
I understand. But please keep in mind that i cannot verify if what you do is working or not and if not why because the same commands for me produce different results. If i understand your description correctly every command that processes an SVG for you apparently will pecified to prneed the density soduce correct results. That is the first, second and fifth in your sequence. Presumably that is If that does not work you should check if all the intermediate images are the correct size (that is 512x512 pixel for all except wetland_tile.png which is 256x256 pixel). If that is not the case that would mean imagemagick does not show consistent results for you at all and you could try using inkscape for rasterization using something like
And then use wetland.png/swamp.png/swamp_hr.png in the process instead of using the SVGs. You might need to use a different resolution value with inkscape than with imagemagick because the mismatch in assumed default resolutions might not be the same. The sizes of the resulting images should be 256x256 pixel for wetland.png, 512x512 for swamp.png and 4096x4096 for swamp_hr.png. |
That will work in some way but blowing up the PNG image to 800% is pretty pointless. As said to use the original process you'd need to rasterize the SVG twice - at native resolution and at eight times the native resolution. So that would probably mean
I don't know. That depends on how you want the pattern to look like in the map. If you unintentially get semi-transparent symbols that is probably because the SVG you use is not black and white. The one in your PR is but maybe you are working with a different one now. |
I included that in the commands sequence, and that gives me this sequence:
This sequence works for me; should I include it in
In fact, the current online version of the wetland patterns already are semi-transparent; that is noticeable, for example, by examining the blue dashes against the transparent grid background of Gimp. I assume this means the semi-transparency is normal and that I can carry on. |
You can but you should indicate that this won't work universally - for me the first command for example results in a 546x546 pixel image.
The blue dash pattern transparency comes from a different source, that is done with the The process gives you full control over color and opacity of the symbols. swamp.png and wetland_pattern_bkg.png essentially serve as alpha masks for the final pattern image compositioning. |
You need an additional But more importantly your pattern is not pixel aligned - if you produced it with jsdotpattern you need to use |
Is there a problem preventing this to be merged? |
My comments on the change as it is now:
I am not opposed to the change as is and not using a different symbol for swamp but i am wondering about the overall strategy. |
Different? I compared the final rendered colors of the tree icons in the new swamp symbol and the current forest symbols, and they are rendered the same:
When I asked about updating this symbol, SK53 warned about boreal swamps which are mainly coniferous, hence keeping the two symbols. Or maybe you mean that the new swamp symbol should take |
Regarding color - i am sorry about that, it looked from your example like the color is different but that might just be because the wetland dashing around creates that impression. Regarding the symbol - yes, the logical step if your goal is to uniformize swamp rendering with forest/wood would be to show leaf_type in the same fashion. If the aim is consistency to normal woodland low use numbers are not a significant factor since despite low use volume this is an undisputed tagging. But you don't have to do that in this PR. I was just asking for the overall strategy here. |
Looks good, thanks. |
More than 3 months since the merge, and it's still not online ? I thought the server problems were solved. |
Reviewing whatever v4.21.1 still has regression bugs would allow recommending it for release. |
@matkoniecz: Ok, thanks for the link! |
It seems the bugs have all been fixed. Should we consider releasing v4.21.1 or v4.22 soon? |
This is my first PR, which I hope is good enough; it fixes #1920 using @imagico's pattern for
wetland=swamp
, which uniformizes the tree icons with the ones ofnatural=wood
andlanduse=forest
.Before:
After:
P.-S.: I closed a first PR for that, it had an authoring problem; it can be safely deleted, if relevant.