-
Notifications
You must be signed in to change notification settings - Fork 268
Description
Given this way in version 1 as input: https://www.openstreetmap.org/way/1422845261/history (a thin, L-shaped, valid polygon)
as source files for convenience:
and this very minimal configuration:
config.json
{
"layers": {
"building": {
"minzoom": 14,
"maxzoom": 14
}
},
"settings": {
"minzoom": 14,
"maxzoom": 14,
"basezoom": 14,
"include_ids": true,
"name": "debug",
"version": "3.0",
"description": "",
"compress": "gzip"
}
}process.lua
function way_function()
Layer("building", true)
endand generating tiles from it:
./tilemaker \
--input bug.osm.pbf \
--output bug.mbtiles \
--config ./config.json \
--process ./process.lua \
--bbox 10.0534129,53.6191617,10.0544429,53.619693 # same as from bug.osm
sqlite3 \
bug.mbtiles \
'select quote(tile_data) from tiles where zoom_level=14 and tile_column=8649 and tile_row=11094' \
| cut -d\' -f2 \
| xxd -r -p > bug.mvt
vt2geojson -z 14 -y 5289 -x 8649 bug.mvtyields a degenerate polygon:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
10.053927898406982,
53.61927620546507
],
[
10.053858160972595,
53.61927620546507
],
[
10.053799152374268,
53.61927620546507
],
[
10.053927898406982,
53.61927620546507
]
]
]
},
"properties": {},
"id": 1422845261
}
]
}The spec technically allows degenerate polygons, but discourages them:
A linear ring SHOULD NOT have an area calculated by the surveyor's formula equal to zero, as this would signify a ring with anomalous geometric points.
It also includes wording like
An exterior ring is DEFINED as a linear ring having a positive area as calculated by applying the surveyor's formula to the vertices of the polygon in tile coordinates.
where it depends on your definition of zero if this is valid or not.
Practically speaking this causes issues in reading libraries like java-vector-tile which skip such polygons and return an empty GeometryCollection instead.
It's unexpected to me that tilemaker:
- modifies the polygon at all. I expected it to be kept 1:1 with the configuration given.
- includes degenerated polygons. If this is the result of a simplification algorithm, excluding the polygon seem sensible as it can't be rendered sensibly anyway.