On mercredi 14 février 2018 15:10:57 CET Rahkonen Jukka (MML) wrote:
> Hi,
> I admit that my test was somewhat lunatic but I took some random dataset
> from Finland with 68101 polygons and converted data into MVT with default
> settings which means that minzoom was 0.  As a result 12196 of the source
> polygons were written into the 0-level protobuf tile (in EPSG:3067 gridset)
> and none of the polygons is valid. Most polygons have too few points and
> those which have enough points have self-intersections.
> Perhaps there should be some sort of geometry validator in the writer chain?

There is some geometry validation, but it is not white&black. In my tests, with 
ne_10m_admin_1_states_provinces dataset, when I initially implemented very 
geometry validation, a number of polygons were completely dropped, so I ended 
implementing a more relaxed logic: for an outer ring, it after conversion to 
coordinates, it is not valid (with GEOSIsValid() testing), then do : buffer( 
tolerance) followed 
by bufffer(-tolerance) followed by simplifypreservetopology(tolerance) (where 
tolerance is 2 
* tile_dim_in_crs_unit / EXTENT) followed by a new round of integer coordinates 
If that's still not valid, keep it.
For an inner ring, drop it if when included in the outer ring, the resulting 
polygon is not valid

Perhaps you could play with the SIMPLIFICATION and SIMPLIFICATION_MAX_ZOOM 
options ?

Perhaps you should also use an already simplified layer for the lowest zoom 
level (see the 
CONF option)

Are you sure you get polygons with less than 4 points ? Normally they should be 


Spatialys - Geospatial professional services
gdal-dev mailing list

Reply via email to