[postgis-users] faster st_dwithin

Michal Palenik michal.palenik at oma.sk
Fri Feb 22 02:26:54 PST 2019


hi all,

I use postgis to query nearby points to a linestring using st_dwithin()

however, in my usecase, the linestrings are too detailed and I do not
need very exact results. I would like function like:
st_dwithin(g1,g2, 100, 110) which:
return true if distance is less than 100
return false if distance is more than 110
return whatever you want if the distance is between 100-110 (but make it fast)

similarly, query points that are within a polygon (or "close" to it)

currently, I use triggers to store simplified version of the linestring,
using trial-and-error paremeters for st_simplify and st_expand (or
larger distance parameter for st_dwithin), with an index on this
simplified line.

apart from problems resulting from two versions of the same line, I do
not know how to control the max-error parameters (110 in the above
example), due to st_simplify working only on geometries, etc.


how would you approach this?


thanks, Michal

-- 
michal palenik
www.freemap.sk
www.oma.sk



More information about the postgis-users mailing list