-
-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow ignore small geometries #792
base: main
Are you sure you want to change the base?
Conversation
just to clarify - do you plan to make this PR remove polygons that are too small for a given zoom level, or do you want to deal with merging "polygon dust" as discussed in #756? Please update the PR description. Thx! |
Hi @nyurik :) ...
WHERE
ST_TRANSFORM("geom",3857) && ST_TileEnvelope(3, 1, 1)
AND ( ST_AREA ( ST_TRANSFORM ( geom, 3857 ) ) >= ( ( 40075016.68 / ( 2 ^ z * 512 ) ) ^ 2 ) )
AND RANDOM() > 0.3
-- the random threshold should be from config maybe
... Yes,It's for #756 |
d7ff0fd
to
045a0b5
Compare
045a0b5
to
d431c81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at the current SQL changes - I looked at ST_AsMVTGeom -- and it has this text:
From 3.0, Wagyu can be chosen at configure time to clip and validate MVT polygons. This library is faster and produces more correct results than the GEOS default, but it might drop small polygons.
Which means that exactly the same filtering is already being done by SQL?
Note that this is different from merging tiny chunks
I think you are right @nyurik /* If possible, peek into the bounding box before deserializing it to discard small geometries
* We don't check COLLECTIONTYPE since that might be a collection of points */
if (type == LINETYPE || type == POLYGONTYPE || type == MULTILINETYPE || type == MULTIPOLYGONTYPE)
{
GBOX gserialized_box;
/* We only apply the optimization if the bounding box is available */
if (gserialized_fast_gbox_p(geom_in, &gserialized_box) == LW_SUCCESS)
{
/* Shortcut to drop geometries smaller than the resolution */
double geom_width = gserialized_box.xmax - gserialized_box.xmin;
double geom_height = gserialized_box.ymax - gserialized_box.ymin;
/* We use half of the square height and width as limit: We use this
* and not area so it works properly with lines */
double bounds_width = ((bounds->xmax - bounds->xmin) / extent) / 2.0;
double bounds_height = ((bounds->ymax - bounds->ymin) / extent) / 2.0;
if (geom_width < bounds_width && geom_height < bounds_height)
{
PG_RETURN_NULL();
}
}
} |
Implements #756