You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using T-Rex to generate WGS84 vector tiles for Natural Earth Data. For this, I import the geopackage into PostGIS and then use this as a datasource for T-Rex.
One layer is specified like this:
[[tileset.layer]]
name = "boundary_lines_land"geometry_field = "geom"geometry_type = "MULTILINESTRING"fid_field = "fid"srid = 4326buffer_size = 0simplify = truemake_valid = true
[[tileset.layer.query]]
minzoom = 0maxzoom = 2sql = """SELECT geom, fid, featurecla, name, min_zoom FROM ne_110m_admin_0_boundary_lines_land WHERE min_zoom::integer <= !zoom! AND geom && !bbox!"""
[[tileset.layer.query]]
minzoom = 3maxzoom = 4sql = """SELECT geom, fid, featurecla, name, min_zoom FROM ne_50m_admin_0_boundary_lines_land WHERE min_zoom::integer <= !zoom! AND geom && !bbox!"""
[[tileset.layer.query]]
minzoom = 5maxzoom = 10sql = """SELECT geom, fid, featurecla, name, min_zoom FROM ne_10m_admin_0_boundary_lines_land WHERE min_zoom::integer <= !zoom! AND geom && !bbox!"""
It seems to work in general 🎉 but unfortunately every line gets simplified to having only ~3 nodes.
Then I found the tolerance parameter, which is per default !pixel_width! / 2.
However, there was no difference when I changed the 2 to 4, 16 or 100 – which appeared very strange.
I look into the codebase about the database queries and the string replacement seems to be working just fine, so this left me to question what pixel_width is.
In more detail, I found the following code:
Thanks for your investigations. Seems clear that the current tolerance default doesn't make sense for geographic coordinates. Thanks for documenting a tolerance configuration,which works better!
I'm using T-Rex to generate WGS84 vector tiles for Natural Earth Data. For this, I import the geopackage into PostGIS and then use this as a datasource for T-Rex.
One layer is specified like this:
It seems to work in general 🎉 but unfortunately every line gets simplified to having only ~3 nodes.
Then I found the
tolerance
parameter, which is per default!pixel_width! / 2
.However, there was no difference when I changed the
2
to4
,16
or100
– which appeared very strange.I look into the codebase about the database queries and the string replacement seems to be working just fine, so this left me to question what
pixel_width
is.In more detail, I found the following code:
t-rex/tile-grid/src/grid.rs
Lines 185 to 193 in f2433f6
So pixel width has something to do with 256-pixel tile width in meters for Web Mercator.
Then, I tried to divide the pixel width with the fixed value that was multiplied to our degree values.
This leads to the following setting:
And this seems to solve the simplification problem to reasonable country borders.
So I guess either there should either be different defaults for different projections for
tolerance
or the pixel size for degrees is debatable.The text was updated successfully, but these errors were encountered: