Is there any solution to add every point of a point feature 4 additional points in all geographic directions in a specified distance?
-
Welcome, Jens! This is not too hard to do in python. Just two questions, do you want the distance to be defined in the same unit as for the dataset with your initial points, e.g. meters for a UTM CRS and do you want the additional points to be in the same dataset as the initial points?– MortenSickelOct 14, 2022 at 7:49
-
1Do you want to add 4 points to data for a point, or is it just for visualization? What type of crs does point layer have, geographic or projected?– Kadir ŞahbazOct 14, 2022 at 7:51
-
Hello @MortenSickel thanks for your answer! yes i want it in the same unit - 20 meters beside the existing points. And the additional points should be in a new dataset.– Jens77Oct 14, 2022 at 7:59
-
1Hello @KadirŞahbaz , thanks for your message! The CRS is EPSG:4326 - WGS 84. Its not just for visualization, I want to research for ecological gradients in specified distances to my starting point.– Jens77Oct 14, 2022 at 8:05
-
1Please, do not forget about "What should I do when someone answers my question?"– TarasDec 13, 2022 at 6:17
3 Answers
You can use the following Processing Toolbox (Ctrl+Shift+T) steps:
- Reproject your layer to a coordinate system with units in meters
- Rectangle ovals diamonds, create rectangles with desired width and height rotated 45 degrees
- Extract the corner points with extract vertices
- Reproject the extracted points back to WGS84
- Merge with your start layer, or don't if you want a separate layer
Essentially the same method as @MrXsquared, but using a loop and with the option to include the original point geometry in the output.
collect_geometries(
-- array_append( -- uncomment to include the original geometry
array_foreach( -- loop through array of angles (in degrees)
array(0, 90, 180, 270),
project( -- the project function is called for every loop iteration
$geometry, -- the origin point of the projection is the original point geometry
100, -- the desired distance
radians(@element) -- convert array element to radians
)
)
-- , $geometry) -- uncomment to include the original geometry
)
You can use an expression:
collect_geometries(
project($geometry, 500, radians(90)),
project($geometry, 500, radians(180)),
project($geometry, 500, radians(270)),
project($geometry, 500, radians(360))
)
This way you can control the distance and angle for each point individually and add as many points as you want. You can either use it as symbology or via "Geometry by expression" from processing toolbox. If you use the latter, it will return MultiPoints, you can convert to SinglePoints by running "Multiparts to singleparts".
-
Not mentioned in the question but in the comments, the crs is 4326 so 500 will be distance in degrees?– BERAOct 14, 2022 at 18:10
-
Yes. Well, then 1) mention in the question and 2) reproject to a metric crs ;) Or use a (lower) distance in degree. Oct 14, 2022 at 18:46