Opened 8 days ago

Last modified 8 days ago

#5744 new enhancement

ST_RemoveIrrelevantPointsForView() - Make optimizations based on cartesian math optional

Reported by: gluser1357 Owned by: pramsey
Priority: medium Milestone: PostGIS 3.5.0
Component: postgis Version: master
Keywords: Cc:

Description (last modified by gluser1357)

The latest optimizations of ST_RemoveIrrelevantPointsForView() (see changes in https://github.com/postgis/postgis/pull/767) for reducing the resulting point number make use of cartesian math and assume that coordinates won't be reprojected after applying ST_RemoveIrrelevantPointsForView() and before rendering.

This is fine for common use cases where no reprojection is taking place, but for other use cases (where coordinates are stored e. g. as lat/lon values, get pre-processed with ST_RemoveIrrelevantPointsForView(), reprojected and rendered), rendering artifacts might occur. For such use cases it would make sense to turn off those optimizations that use cartesian math. This can be achieved by using a new flag cartesian_hint. By default (if not specified), no optimizations are done.

Here the link to the PR that contains the required changes: https://github.com/postgis/postgis/pull/774

Change History (3)

comment:1 by gluser1357, 8 days ago

Description: modified (diff)

comment:2 by strk, 8 days ago

May I ask for the rationale of removing irrelevant points BEFORE reprojection ? Couldn't you just reproject first and remove irrelevant points once the geometries are in the final projection ?

comment:3 by gluser1357, 8 days ago

For use cases where the data is already projected, or where postgis can do the final projection, this would surely work.

For our vector web client which is completely based on unprojected lat/lon coordinates, this doesn't work: The client dynamically projects and renders the unprojected data itself (among the possible projections is e. g. also "space view" projection where views are computed on-the-fly from the available data while the user is dragging the mouse). The lat/lon coordinates are stored in postgis tables, queried on-the-fly on server-side when the user pans or zooms to a new area. To achieve best performance and safe I/O bandwidth we need to early and quickly sort out irrelevant lat/lon coordinates (e. g. all coordinates of a large country border being outside of a small-scale view). That's why we need this function to be able to deal also with unprojected data.

Note: See TracTickets for help on using tickets.