Skip to main content
added 105 characters in body
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148

Tested on QGIS 2.18

I can suggestThere is a possibility using a "Virtual Layer""Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have two layers, namely "lines_test"'lines_test' and "polygons"'polygons'

Input

With using this query you may achieve the result you are looking for.it is possible to differentiate between line ending within polygon and line passing all the way through polygon.

SELECT *
FROM polygons
WHERE polygons.id NOT IN (
    SELECT polygons.id
    FROM polygons, lines_test
    WHERE ST_Within(ST_StartPoint(lines_test.geometry), polygons.geometry)
          OR ST_Within(ST_EndPoint(lines_test.geometry), polygons.geometry)
)

Output


References:

Tested on QGIS 2.18

I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have two layers, namely "lines_test" and "polygons"

Input

With using this query you may achieve the result you are looking for.

SELECT *
FROM polygons
WHERE polygons.id NOT IN (
    SELECT polygons.id
    FROM polygons, lines_test
    WHERE ST_Within(ST_StartPoint(lines_test.geometry), polygons.geometry) OR ST_Within(ST_EndPoint(lines_test.geometry), polygons.geometry)
)

Output


References:

There is a possibility using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have two layers, namely 'lines_test' and 'polygons'

Input

With using this query it is possible to differentiate between line ending within polygon and line passing all the way through polygon.

SELECT *
FROM polygons
WHERE polygons.id NOT IN (
    SELECT polygons.id
    FROM polygons, lines_test
    WHERE ST_Within(ST_StartPoint(lines_test.geometry), polygons.geometry)
          OR ST_Within(ST_EndPoint(lines_test.geometry), polygons.geometry)
)

Output


References:

Tiny adjustments
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148

Tested on QGIS 2.18

I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have two layers, namely "lines_test" and "polygons"

Input

With using this query you may achieve the result you are looking for.

SELECT *
FROM polygons
WHERE polygons.id NOT IN (
    SELECT polygons.id
    FROM polygons, lines_test
    WHERE ST_Within(ST_StartPoint(lines_test.geometry), polygons.geometry) OR ST_Within(ST_EndPoint(lines_test.geometry), polygons.geometry)
)
SELECT *
FROM polygons
WHERE polygons.id NOT IN (
    SELECT polygons.id
    FROM polygons, lines_test
    WHERE ST_Within(ST_StartPoint(lines_test.geometry), polygons.geometry) OR ST_Within(ST_EndPoint(lines_test.geometry), polygons.geometry)
)

Output


References:

Tested on QGIS 2.18

I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have two layers, namely "lines_test" and "polygons"

Input

With using this query you may achieve the result you are looking for.

SELECT *
FROM polygons
WHERE polygons.id NOT IN (
    SELECT polygons.id
    FROM polygons, lines_test
    WHERE ST_Within(ST_StartPoint(lines_test.geometry), polygons.geometry) OR ST_Within(ST_EndPoint(lines_test.geometry), polygons.geometry)
)

Output


References:

Tested on QGIS 2.18

I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have two layers, namely "lines_test" and "polygons"

Input

With using this query you may achieve the result you are looking for.

SELECT *
FROM polygons
WHERE polygons.id NOT IN (
    SELECT polygons.id
    FROM polygons, lines_test
    WHERE ST_Within(ST_StartPoint(lines_test.geometry), polygons.geometry) OR ST_Within(ST_EndPoint(lines_test.geometry), polygons.geometry)
)

Output


References:

Tiny adjustments
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148

Tested on QGIS 2.18

I can suggest using Virtual Layera "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have two layers, namely "lines_test" and "polygons"

Input

With using this query you may achieve the result you are looking for.

SELECT *
FROM polygons
WHERE polygons.id NOT IN (
    SELECT polygons.id
    FROM polygons, lines_test
    WHERE ST_Within(ST_StartPoint(lines_test.geometry), polygons.geometry) OR ST_Within(ST_EndPoint(lines_test.geometry), polygons.geometry)
)

Output


References:

Tested on QGIS 2.18

I can suggest using Virtual Layer through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have two layers, namely "lines_test" and "polygons"

Input

With using this query you may achieve the result you are looking for.

SELECT *
FROM polygons
WHERE polygons.id NOT IN (
    SELECT polygons.id
    FROM polygons, lines_test
    WHERE ST_Within(ST_StartPoint(lines_test.geometry), polygons.geometry) OR ST_Within(ST_EndPoint(lines_test.geometry), polygons.geometry)
)

Output


References:

Tested on QGIS 2.18

I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have two layers, namely "lines_test" and "polygons"

Input

With using this query you may achieve the result you are looking for.

SELECT *
FROM polygons
WHERE polygons.id NOT IN (
    SELECT polygons.id
    FROM polygons, lines_test
    WHERE ST_Within(ST_StartPoint(lines_test.geometry), polygons.geometry) OR ST_Within(ST_EndPoint(lines_test.geometry), polygons.geometry)
)

Output


References:

Tiny adjustments
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148
Loading
Reference added
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148
Loading
Answer extended
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148
Loading
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148
Loading