5

I am a new postgis user and I have a simple question. My intention is to know all point values that not have a line feature near (10 meters of tolerance) How can I do this?

I've tried to find by ST_Dwithin operator, but I need the opposite result. All line features are not within the point radius. Something similar to "not covered by..."

artwork21
  • 35,114
  • 8
  • 66
  • 134
Caio Mattos
  • 115
  • 7
  • Can you please edit your question to include what you have tried? – MaryBeth Jan 02 '18 at 19:51
  • Welcome to GIS SE. As a new user, please take the [Tour]. SQL questions here are expected to contain SQL code (at a minimum, including the table names and geometry column name(s)). We'll also need you to [Edit] the question to provide more information about the total number of features, and the number of expected features in your result set (this can impact which of the two principal approaches to take). – Vince Jan 03 '18 at 00:46
  • 1
    related but ST_Intersects with LEFT Join https://gis.stackexchange.com/questions/4502/postgis-select-features-that-do-not-intersect – Mapperz Jan 03 '18 at 01:13

1 Answers1

7

Just use a NOT EXISTS ( SELECT FROM WHERE ST_DWithin() )

SELECT *
FROM t1
WHERE NOT EXISTS (
  SELECT 1
  FROM t2
  WHERE ST_DWithin( t1, t2, m )
);

This will return all t1 not within m of t2

Evan Carroll
  • 7,071
  • 2
  • 32
  • 58