enzet / map-machine

Python renderer for OpenStreetMap with custom icons intended to display as many map features as possible
MIT License
515 stars 34 forks source link

Lake intersecting viewport is rendered wrong #143

Closed habi closed 2 years ago

habi commented 2 years ago

I'd like to produce a high-resolution render of a campsite and can do this by issuing map-machine render --boundary-box=6.712,46.802,6.723,46.807 --zoom=16 --output=out/vd8.svg.

This does render the lake bordering the campsite weirdly, e.g. glitches out with the intersection of the campsite. I know that rendering of lakes or larger water bodies is complicated, but how could I generate a nice map of this campsite?

map

habi commented 2 years ago

Some observations in relation to the lake rendering

At first I thougth it's because of the 'layering' of the lake with a swimming area also mapped there, but I now think it might have something to do with a wetland polygon in the vicinity.

enzet commented 2 years ago

Hello, @habi!

Thank you for the issue. I'm afraid, this is really a hard one. Map Machine downloads only ways that at least partly present inside boundary box, so it doesn't have enough information about lake shape.

I may provide two ways to fix that:

  1. Easy one is to just try to download more data. I'll add an option to specify another bigger boundary box for downloading.
  2. Hard one is to try to honestly compute lake shape analysing way direction.

I think, I want to start with the first one and then will continue with the second one.

habi commented 2 years ago

There's no option for 'discarding' a feature (the lake) in map-machine? Or could I somehow twiddle with the downloaded XML and try to remove all 'traces' of the lake?

enzet commented 2 years ago

Sure, you just need to either edit default scheme file or use a custom scheme file.

E.g. use no_water.yml and --scheme option:

map-machine render --coordinates=46.805,6.715 --zoom=16 --output=out/bad0.svg --scheme no_water.yml

no_water.yml is just map_machine/scheme/default.yml with the following diff:

   - tags: {natural: water}
     exception: {intermittent: "yes"}
     style:
-      fill: water_color
-      # stroke: water_border_color
-      # stroke-width: 1.0
+      # fill: water_color
+      stroke: water_border_color
+      stroke-width: 1.0
     priority: 21.0
enzet commented 2 years ago

This is a duplicate of #120.