mapsforge / vtm

OpenGL vector map library - running on Android, iOS, Desktop and browser.
GNU Lesser General Public License v3.0
272 stars 89 forks source link

Overlapping map (water) regions not filled #224

Closed Klaus-Tockloth closed 6 years ago

Klaus-Tockloth commented 8 years ago

This water polygon isn't filled in vtm as it does in mapsforge:

Mapsforge: bildschirmfoto 2016-11-01 um 16 51 15

VTM (the eastern part of Lake Zurich is (probably) not filled): bildschirmfoto 2016-11-01 um 16 51 31

The issue can be reproduces: Map: http://download.freizeitkarte-osm.de/android/latest/freizeitkarte_che+.map.zip Theme: https://dl.dropboxusercontent.com/u/1677057/freizeitkarte-vtm.zip

devemux86 commented 8 years ago

I can confirm it also with Mapsforge switzerland.map.

Klaus-Tockloth commented 8 years ago

Here's a second example of a missing area:

bildschirmfoto 2016-11-04 um 20 33 17

bildschirmfoto 2016-11-04 um 20 33 27

devemux86 commented 8 years ago

Probably because of polygons using the default stencil buffer rendering without tessellation, require elements coming from one layer to not overlap. Using the mesh rendering is slightly slower to load (requires tessellation) and requires more memory, but should be faster to render. And it does not support currently pattern textures. More details in #212.

So adding mesh="true" to area water rule, the lake appears complete. @Klaus-Tockloth can you test in your theme?

mesh

Klaus-Tockloth commented 8 years ago

So adding mesh="true" to area water rule, the lake appears complete.

Yes, this solves the issue: <area fill="#80cccc" mesh="true" stroke="#3CCBCB" stroke-width="0.1" />

Before: bildschirmfoto 2016-11-16 um 18 18 14

After: bildschirmfoto 2016-11-16 um 18 19 18

Klaus-Tockloth commented 8 years ago

The second example is a bit more complex:

bildschirmfoto 2016-11-16 um 18 16 58

This is an area (power=sub_station) which is completely surrounded by a fence (barrier=fence). Both objects are included in the map data. The theme renders power=substation as area and barrier=fence as line. Both objects are closed ways. It seems that the fence (drawn as thin line) completely subtracts the sub_station area.

This is the current (incorrect) result: bildschirmfoto 2016-11-16 um 18 15 03

And that would be the expected result: bildschirmfoto 2016-11-16 um 18 31 49

devemux86 commented 8 years ago

There was a similar situation in Osmarender, where overlapping natural=scrub gets subtracted with other natural areas. I first added mesh=true in b6bfbc612a046aa99e7328ac5e786ce27c581c87 to fix it.

But our other themes do not have that problem, so it's clearly a rules organization issue. I separated them in 7c9c3732fb94577cd951717432720176f3263c74 and now the overlapping natural areas render without mesh (tessellation).

So maybe some cases can be solved by better organizing their theme rules?

Klaus-Tockloth commented 8 years ago

mesh="true" doesn't work in the (second) case where the area is complete within another area.

devemux86 commented 8 years ago

@Klaus-Tockloth how is that render theme rule for the 2nd case?

Klaus-Tockloth commented 8 years ago

First the area:

    <m e="way" k="power" v="plant|generator|substation|station|sub_station" closed="yes">
      <area src="file:/patterns/kraftwerk.svg" symbol-scaling="size" symbol-width="32" />
      <m e="way"   zoom-min="17">
        <caption k="name" style="normal" size="11" fill="#191919" stroke="#00123456" stroke-width="1.0" />
      </m>
    </m>

And later the line:

    <m e="way" k="barrier" v="fence|wall|city_wall|retaining_wall" zoom-min="16">
      <line stroke="#888888" stroke-width="0.1" />
    </m>
devemux86 commented 6 years ago

Similar(?) case mentioned in OpenAndroMaps forum.

EDIT: looks like false alert, see Christian's answer there.

devemux86 commented 6 years ago

I enabled for now tessellation on water areas, let's see how it goes.

devemux86 commented 6 years ago

Lake Constance (Bodensee) with maps of Austria+Switzerland open together:

constance

devemux86 commented 4 years ago

Performance and stability are more important, as well as proper rendering.

Netherlands before: 1

Netherlands after: 2

devemux86 commented 2 years ago

Fixed in #903 #905.