Mercurial > gemma
changeset 2127:a1f2cfa624cf
Make distance filtering more consistent
Filtering by the true distance between two points instead of by
intersection of one point with the bounding box of a buffer around
the other point. This makes a difference near the edges of that
bounding box.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 06 Feb 2019 15:23:30 +0100 |
parents | d4a5e475f874 |
children | bc310a0b5bae |
files | pkg/imports/wp.go |
diffstat | 1 files changed, 5 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/wp.go Wed Feb 06 14:27:14 2019 +0100 +++ b/pkg/imports/wp.go Wed Feb 06 15:23:30 2019 +0100 @@ -98,14 +98,6 @@ )` insertWaterwayProfileSQL = ` -WITH point AS ( - SELECT - ST_Buffer(geom, $14::float) AS geom, - geom AS point - FROM waterway.distance_marks_virtual - WHERE location_code = - ($1::char(2), $2::char(3), $3::char(5), $4::char(5), $5::int) -) INSERT INTO waterway.waterway_profiles ( location, geom, @@ -120,9 +112,11 @@ ) VALUES ( ($1, $2, $3, $4, $5), ( SELECT wp_geoms.geom - FROM wp_geoms, point - WHERE wp_geoms.geom && point.geom - ORDER BY ST_Distance(point.point, wp_geoms.geom, true) + FROM wp_geoms, waterway.distance_marks_virtual AS dmv + WHERE dmv.location_code = + ($1::char(2), $2::char(3), $3::char(5), $4::char(5), $5::int) + AND ST_DWithin(dmv.geom, wp_geoms.geom, $14::float) + ORDER BY ST_Distance(dmv.geom, wp_geoms.geom, true) LIMIT 1 ), $6,