Skip to content
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

wetland rendering differentiated by wetland type #1497

Merged
merged 4 commits into from
May 5, 2015

Conversation

imagico
Copy link
Collaborator

@imagico imagico commented Apr 22, 2015

resolves #387, #1158

This adds specialized patterns for various types of wetland as indicated by the wetland tag. It also unifies natural=mud with wetland in terms of style - it is rendered like wetland=tidalflat.

As before the wetland pattern is rendered as an overlay. The base color - if it exists - is rendered in the landcover layer. There wetland has priority over landuse so if a wetland polygon has also a landuse tag (which is quite common) the wetland type supersedes the landuse for the base color. Rendering with the basic wetland pattern starts at z=10 as before. The specialized patterns are used at z=14 and above. Also the wetland pattern is less strong than before (fixing #1158)

Here are generic styling examples for all different pattern types as used at high zooms:

bog and swamp:

bogswamp

bog uses the base color from heath, swamp from wood.

saltmarsh and reedbed:

saltmarshreedbed

marsh and wet_meadow are rendered the same as saltmarsh, just with the grass color as base color.

tidalflat/mud and mangrove:

tidalflatmangrove

As can be seen the last two use a semitransparent base color. This is to make sure the coastline is always clearly visible even if a wetland polygon is drawn across it and transparency is the only way to do this. The colors are designed to match the previous mud color and wood color when used over land. If there is fear this might cause confusing colors when overlapping with other landcovers i can move these to a separate layer rendered before the landcover layer. This would ensure only the coastline layer is below, it would however also complicate the code quite a bit.

Practical rendering examples:

z=13:
z=13

z=14:
z=14

Showing how the overlay renders above water areas:
bog

I did not touch the labels - they are still rendered in strong blue for all types of wetland. This seems fine to me but can be changed of course.

Mangrove rendering showing which areas are inside and outside the coastline:
mangrove

@pnorman
Copy link
Collaborator

pnorman commented Apr 22, 2015

impacts #1242

@dieterdreist
Copy link

2015-04-23 0:34 GMT+02:00 imagico notifications@github.com:

resolves #387
#387, #1158
#1158

This adds specialized patterns for various types of wetland as indicated
by the wetland tag.

very nice!

@imagico
Copy link
Collaborator Author

imagico commented Apr 23, 2015

Made some small changes: For consistency and to avoid irritating color changes when zooming the base color of swamp/mangrove is rendered from z=8 like wood/forest. Tidalflat is shown from z=9 which is consistent with the other bare ground tags and seems appropriate since tidal flats are frequently larger areas.

@nebulon42
Copy link
Contributor

It would be great to include also the source files of the patterns - if feasible e.g. because they are SVG - to allow for easier customisation.

@imagico
Copy link
Collaborator Author

imagico commented Apr 24, 2015

The patterns as a whole do not exist in SVG form, they are assembled using raster processing (i.e. masking the base dash pattern around the symbols). I will however include the symbols used with jsdotpattern and can also make available the point arrangement - here with the mangrove symbol:

mangrove pattern svg

@imagico
Copy link
Collaborator Author

imagico commented Apr 24, 2015

Mud labels now also match the wetland labels:

wetland labels

@nebulon42
Copy link
Contributor

I will however include the symbols used with jsdotpattern and can also make available the point arrangement

Yes, that's what I meant. Probably the form of including this in the style has to be discussed, but I always thought that it would be important to offer forks the possibility to change the patterns easily without having to recreate them from scratch (meaning the symbols and arrangement).

@gravitystorm
Copy link
Owner

We'll need the patterns in SVG too, eventually. Mapnik 2.x can only use raster patterns in patternsymbolizers, but this limitation is removed in mapnik 3.x so we'll prefer SVG patternsymbolizers at that point.

@imagico
Copy link
Collaborator Author

imagico commented Apr 26, 2015

I agree having SVGs for patterns could be useful, especially for rendering the style at different resolutions - however the design of the patterns here currently relies on raster processing and some parts of this (in particular use of hit-and-miss pattern matching - see http://www.imagemagick.org/Usage/morphology/#hmt) cannot easily be translated into vector operations. This means creating matching SVGs will be complicated and this only makes sense to do when a pattern is finalized.

@pnorman also mentioned in imagico/jsdotpattern#3 that mapnik 3 has limitations in SVG support that would significantly blow up SVG file sizes for patterns with lots of or complex symbols - the current bare ground patterns for example would each be several megabytes in size as SVGs in mapnik compatible form.

Long story short - i think the concept of SVG patterns has still quite a lot of open questions. Re. editability as @nebulon42 hinted the question is for example if and to what extent it makes sense to manually edit pattern SVGs in programs like Inkscape where maintaining the periodicity is not ensured.

Another thing - does anyone know if mapnik 3 pre-rasterizes SVG patterns when they are used? If not i'd estimate using them will have a significant negative performance impact.

@imagico
Copy link
Collaborator Author

imagico commented Apr 28, 2015

rebased - from my side this is ready now.

@@ -442,6 +444,45 @@
}
}

[feature = 'wetland_mud'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be natural_mud?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, in https://github.com/imagico/openstreetmap-carto/blob/wetland-improvements/project.yaml#L151 mud and marsh are translated to wetland types so natural=marsh/mud and natural=wetland+wetland=marsh/mud are treated exactly the same. This could of course also be done in the style sheet but this seems more consistent in result, esp. with regard to priorities in COALESCE() - otherwise a polygon tagged natural=marsh + landuse=* would be rendered different to one tagged natural=wetland + wetland=marsh + landuse=*.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I see now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see.

@matthijsmelissen
Copy link
Collaborator

Looks nice!

The only thing I'm not happy about it is the transparency. I think indeed that it would give undesired colours when overlapping with other landuse.

I also don't think that the transparency over land/water is intuitive. In pictures like this:

Mangrove

it is not intuitive to me that the darker parts are actually outside the coastline.

I'm also not sure if the coastline is a relevant physical feature on high zoom levels, so I wouldn't mind if it weren't visible.

@matkoniecz
Copy link
Contributor

it is not intuitive to me that the darker parts are actually outside the coastline.

Yes, I expected that darker part is a land.

@imagico
Copy link
Collaborator Author

imagico commented Apr 29, 2015

Ok - first the sample image is not actually very good since it is relatively bad mapping there and the boundary also adds to the confusion. But i see that the different color over water is not very clear in case of mangrove which probably has partly to do with the fact that transparency is fairly low and to get the same color as wood over land the color itself has to be very dark.

I'm also not sure if the coastline is a relevant physical feature on high zoom levels, so I wouldn't mind if it weren't visible.

The point is that by hiding it mappers are discouraged from proper placement - it does not seem to matter since it has no effect on the rendering result. We can already widely see this in case of natural=coastline vs. natural=water. So i would rather render mangrove and tidalflat without a base color than with one that obscures the coastline.

Note this is not a high zoom level problem only - both these types of wetland cover quite large areas in some cases and an arbitrary placement of the coastline within such wetlands will have a very bad effect on the coastline quality.

I could imagine three measures:

  • make the mangrove color more transparent so the distinction over water/over land is clearer. In any case the part over water will be darker than over land - unless i use a different comp-op - which however would probably be even less intuitive.
  • create an additional wetland base color layer to avoid interference with other landcovers. Note the risk of problems because of this is fairly low since the wetlands in questions tend to be fairly large and the ordering is by size - you would need a different larger landcover polygon overlapping with a smaller mangrove/tidalflat polygon. I am sure there are cases of this but it is definitely not a very common scenario.
  • remove the base color from mangrove/tidalflat - tidalflat would then be rendered like generic wetland and mangrove like saltmarsh, just with a different symbol.

below is an example for 50/60 percent transparency for mangrove (current is 25):

50
60

and here using exclusion comp-op:

exclusion

@imagico
Copy link
Collaborator Author

imagico commented Apr 29, 2015

Found a somewhat better area for mangrove mapping crossing the coastline southeast of Mumbai:

mangrove example 1
mangrove example 2

Yes, the difference is fairly subtle - could be emphasized more as shown in the previous comment. But i don't think there is normally confusion which part is inside and which is outside the coastline.

@matthijsmelissen
Copy link
Collaborator

Actually I still don't recognize it as coastline, rather as two different types of vegetation.

@imagico
Copy link
Collaborator Author

imagico commented Apr 29, 2015

Well - in a way it is - one is mangrove forest above the high water line, the other is mangrove forest below it.

Some level of obfuscation of the coastline seems appropriate considering mangrove does make it less recognizable in reality. But having it still visible, at least in a subtle way tells the mapper: it still matters, take care about placing it sensibly. Hiding it fully conveys the message: once you mapped the mangroves the coastline is not important any more, just close it somehow as it is convenient.

I tried the more transparent colors shown above but the part over water is too dark IMO compared to the rest of the style.

Using water polygons instead of land polygons would give some more options of course.

@pnorman
Copy link
Collaborator

pnorman commented Apr 29, 2015

Using water polygons instead of land polygons would give some more options of course.

This is on the to do list

moving tidalflat base color to a separate symbolizer
removing now unused mud from natural in SQL
@imagico
Copy link
Collaborator Author

imagico commented May 1, 2015

I removed the mangrove base color now since it is generally not found favorable. I also moved the tidalflat/mud base color rendering to a separate symbolizer which i think makes sure it is rendered before the other landcovers without the need for a separate layer.

Sample:

mangrove without base color

@sommerluk
Copy link
Collaborator

I removed the mangrove base color now

I like the approach without base colour! Especially because your intention is to make clear that it matters where the coastline passes – and the version without base colour makes this clearer.

@imagico
Copy link
Collaborator Author

imagico commented May 1, 2015

It is not too bad IMO - but since mangrove would also usually be considered a type of woodland it would make sense to for it to use the base color of natural=wood - especially since at least in the inner tropics mangrove usually transits seamlessly into tropical rainforest under natural conditions.

Not using a base color might encourage mappers to map wood/forest in addition but not more than right now and practical mapping of mangrove areas right now is overwhelmingly using natural=wetland without another solid color area tag in addition.

When we move to water polygons it would be easily possible to use the wood base color over land and a mixture of wood and water color over water - this would be the best solution i think.

@matthijsmelissen
Copy link
Collaborator

I also moved the tidalflat/mud base color rendering to a separate symbolizer which i think makes sure it is rendered before the other landcovers without the need for a separate layer.

Yes, that works.

However, what about other landcover inside tidalflat/mud? I can think of leisure=track inside landuse=mud, for example. Your approach would not render the track. Currently we order landuse by area size, and this would be inconsistent with that approach.

@imagico
Copy link
Collaborator Author

imagico commented May 1, 2015

Other landcovers within tidalflat/mud work fine, here natural=sand within natural=mud (somewhat suboptimal tagging of course but that's not the issue here):

sand within mud

Of course a small tidalflat/mud area within a larger other landcover would probably only render with the wetland overlay.

@matthijsmelissen
Copy link
Collaborator

You're right, I read

I also moved the tidalflat/mud base color rendering to a separate symbolizer which i think makes sure it is rendered before the other landcovers without the need for a separate layer.

the wrong way around.

@matthijsmelissen
Copy link
Collaborator

Thanks, looks very good!

@matthijsmelissen matthijsmelissen merged commit 4c526e5 into gravitystorm:master May 5, 2015
@imagico
Copy link
Collaborator Author

imagico commented May 5, 2015

Ok, thanks for reviewing and merging.

@nebulon42
Copy link
Contributor

I'd like to mention again that it would be nice having also source files/symbols included in the style somehow. Especially since most symbols are now going to be SVG it would be great if also patterns could be easily customised. I can open an issue for that though, if that is better suited.

@matthijsmelissen
Copy link
Collaborator

I can open an issue for that though, if that is better suited.

Yes, please. I agree, but thought it was not worth postponing the merge for this reason.

@nebulon42
Copy link
Contributor

No, of course not - and yes. :)

@malcolmh
Copy link

malcolmh commented May 6, 2015

Could you please summarise the tagging used for the above illustrations?

@malcolmh
Copy link

malcolmh commented May 8, 2015

Interesting. Looking at those examples, I see that natural=water is used in preference to waterway=riverbank to produce the correct rendering. There is a long-unfixed issue (#115) regarding this.

@malcolmh
Copy link

malcolmh commented May 8, 2015

Tidal flats can expose various surfaces: mud, sand, shingle, etc. Will these cases be rendered with different background colours for different surface=* modifiers?

@imagico
Copy link
Collaborator Author

imagico commented May 8, 2015

Currently there is no established tagging for that - wetland=tidalflat is not used significantly in combination with surface=*. Larger flat tidal areas (which is the meaning of tidalflat) also generally feature very small grained material at the surface - hence are usually muddy.

Sand/gravel features in tidal areas would often most accurately be tagged natural=shoal - #545 mentions the possibility of rendering this. Another possible improvement is rendering the tidal part of natural=beach different from that above the high water line. This once again would probably require use of water polygons.

@malcolmh
Copy link

malcolmh commented May 8, 2015

Shoal is not the same as tidalflat. Shoals can be permanently underwater, permanently above water or exposed by the tide.

I could find no explanation of "water polygons" in the Wiki. What is meant by this term in this context?

@imagico
Copy link
Collaborator Author

imagico commented May 8, 2015

This is not the place for discussing tagging - if there are a significant number of areas you consider rightfully tagged natural=wetland + wetland=tidalflat + surface!=mud it might be worth looking into rendering them in a distinct form - i am not sure such areas exist though. Best to discuss this first in local community or on tagging ML.

water polygons refers to use of

http://openstreetmapdata.com/data/water-polygons

rather than (as right now)

http://openstreetmapdata.com/data/land-polygons

for rendering the ocean/land distinction. This has been in discussion occasionally for a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rendering tidal flats
9 participants