Opened 6 months ago

Closed 4 months ago

#5744 closed defect (fixed)

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 (5)

comment:1 by gluser1357, 6 months ago

Description: modified (diff)

comment:2 by strk, 6 months 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, 6 months 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.

comment:4 by gluser1357, 5 months ago

Type: enhancementdefect

Since this issue fixes problems when ST_RemoveIrrelevantPointsForView() is applied to non-cartesian (non-projected) coordinates I changed this ticket to type defect.

This fix should be part of Postgis 3.5.0 which introduces ST_RemoveIrrelevantPointsForView().

See further discussions in Github PR linked above.

comment:5 by strk, 4 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.