How to remove the line from inside the circle in QGIS?
-
1Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq.– underdarkCommented Jan 10, 2017 at 19:33
-
Do you want to remove the entire line or just the line segment inside the circle?– Evan CarrollCommented Jan 10, 2017 at 20:17
-
Line segment inside the circle.– Brukarz BrukarzCommented Jan 10, 2017 at 20:36
-
Do you want to edit the vector data or are you aiming at a nice visualization? The latter probably requires the first, though.– user30184Commented Jan 10, 2017 at 21:00
-
Im aiming at a nice visualization:)– Brukarz BrukarzCommented Jan 10, 2017 at 21:09
|
Show 1 more comment
1 Answer
To demonstrate
- Create the x-point
0,0
- Create the y-point
3,0
- Create a circle around
x-point
with a radius of 1. - Create a line from x-y.
- Find the difference between the line and the circle.
- Returns that as
ST_AsText
Code,
WITH data AS (
SELECT
x AS point,
ST_Buffer(x,1) AS circle,
ST_MakeLine(x,y) AS line
FROM ( VALUES
(ST_MakePoint(0,0), ST_MakePoint(3,0))
) AS t(x, y)
)
SELECT ST_AsText(ST_Difference(line, circle))
FROM data;
Returns
st_astext
---------------------
LINESTRING(1 0,3 0)
This excludes the circle (0,0)
with a radius of one