artemp / vector-tile-server

Vector tile server and rendering backend for Mapnik
60 stars 15 forks source link

Polygon clipping issues #3

Open hjanetzek opened 11 years ago

hjanetzek commented 11 years ago

It seems that the default agg polygon clipper is not reliable when it is used for geometry output, as stated on their site. I tried to figure out what might cause the broken polygons when using this backend in VectorTileMap and found that the clipping messes things up. I've hacked Clipper into polygon processing and it seems to do the job well. the results is in my 'origin' branch. maybe you can integrate it properly :)

artemp commented 11 years ago

@hjanetzek - great, thanks, I'll have a look. Do you have a screenshot with broken polygons ?

hjanetzek commented 11 years ago

most of these wrong points were not visible because the 'stencil buffer method' for polygon drawing can cope it. one can see it with buidling outlines for example[1] and when using triangulation on the clipped output duplicate nodes and coincident lines which go back and forth cause trouble[2].

e.g. tile: 17/68736/42655 the building at top center http://city.informatik.uni-bremen.de/~jeff/screenshots/Screenshot_2013-01-14-12-35-52.png the point at position 6 is not on the building: tags: [0] indx: [10] 1029 1360 2265 0 2687 0 1431 1387 1713 1643 3263 0 4096 0 3673 0 1777 2016 1029 1360

[1]http://city.informatik.uni-bremen.de/~jeff/screenshots/Screenshot_2013-01-14-13-30-47.png [2]http://city.informatik.uni-bremen.de/~jeff/screenshots/Screenshot_2013-01-14-13-31-02.png

Clipper produces tags: [0] indx: [8] 2265 0 2687 0 1431 1387 1713 1643 3263 0 3673 0 1777 2016 1029 1360

[1]http://city.informatik.uni-bremen.de/~jeff/screenshots/Screenshot_2013-01-14-14-13-33.png [2] http://city.informatik.uni-bremen.de/~jeff/screenshots/Screenshot_2013-01-14-14-15-03.png

another one where clipping fill the tile with water (behind residential) http://city.informatik.uni-bremen.de/~jeff/screenshots/Screenshot_2013-01-14-12-24-52.png http://city.informatik.uni-bremen.de/~jeff/screenshots/Screenshot_2013-01-14-12-49-03.png

I had a few more really results that I cannot find atm where complex landuse polygons should result in one tile filling quad but were made of 9 points.

hjanetzek commented 11 years ago

btw. the problem with drawing all objects for one layer (by tag) in one go via stencil buffer is that overallping parts will cancel each other out.. just in case that you see it and wonder whats goind on.