0

I'm very new to QGIS 3 and I have a problem. I got a point.shp indicating coastal transects long the world's coast set 500 m apart. I selected a subset projecting only the sandy transects along the Dutch coastline. From these points I know want to create a 5 km long transect inland 90° to the existing shoreline. The first picture shows the available points, second picture is a zoom-in and the red lines indicate what I want to achieve. Is there any way on how to create these inland transects perpendicular to the shore? Any suggestions, insights, tips, etc?

enter image description here enter image description here

3 Answers 3

2

It can be done using Geometry by expression tool (in Processing Toolbox > Vector geometry).

Assumption: (Please modify them as necessary)

  • Your Dutch coastline layername: Coast
  • The coastline layer has an id (e.g."fid") field, and the said coastline's id is 1 .

enter image description here

After starting Geometry by expression tool, please set parameters as:

enter image description here

  • Input layer: your start points layer
  • Output geometry: Line

(Geometry expression)

make_line($geometry, 
          project($geometry, 
                  5000, 
                  azimuth($geometry, 
                          closest_point(
                            geometry(get_feature('Coast','fid', '1')), 
                            $geometry))))

This expression may look complicated, but -

  1. First, closest_point(geometry(get_feature('Coast','fid', '1')), $geometry) finds a point on the coastline which is at the shortest distance from your start points.
  2. Then azimuth() will find the bearing of the above point from the start point.
  3. And project($geometry, 5000, xxx) will move your start point to the azimuth() direction by 5000m.
  4. Finally, make_line($geometry, xxxx) will draw a line from the start point to the project(ed) point in the above Step 3.
1
  • Also, when opening the "expression" tab in the "Geometry by expression"-panel, it states as "Output Prieview=NULL"
    – SolH
    Commented Jun 23, 2020 at 15:19
-2

Firstly, thank you so much for taking the time to consider my issue. I tried to run the code you sent me. It works in the sense that it executes the command and I create an output .shp, however, it just projects an empty layer, despite the fact that I have an attribute table with information in it. Any suggestions on what goes wrong?

enter image description here

4
  • Geometry by expression will not produce or copy attributes so I suspect you have used other tool.
    – Kazuhito
    Commented Jun 23, 2020 at 7:51
  • I definitely used Geometry by expression. But then, my coastline also has a big attribute table and not just one field like yours. Could that be the issue?
    – SolH
    Commented Jun 24, 2020 at 8:02
  • No, I don't think the attribute table of the coastline can affect the output. Out of curiosity, are your point and coastline layers on the same CRS?
    – Kazuhito
    Commented Jun 24, 2020 at 8:48
  • I have been thinking possible cause of this strange output... can I ask which layer have you assigned to Input layer? Any possibility you have used coastline as the input layer?
    – Kazuhito
    Commented Jun 24, 2020 at 9:04
-2

Thank you for baring with me. So, as you can see in the picture, I used the transect points layer as the input layer. All my layers are on the CSR Amersfoort / RD New 28992 However, my coastline does not only have one field, like in your example but a very extensive attribute table (see picture 2). Could this be the problem? If you, where did you get your Dutch coastline .shp file form? Maybe if I use your coastline layer it would work?

enter image description here

enter image description here

4
  • sorry, just saw that you said the coastline attribute table shouldn't be the problem.
    – SolH
    Commented Jun 24, 2020 at 19:51
  • Hi, welcome to GIS StackExchange, you are posting answers to your question, but you are not answering it. The Post Your Answer section is reserved to post an answer. You can write comments in Kazuhito's answer if you want to comment their answer, or you can improve your question editing it to include more details or sample data to let the users write an answer that fits exactly your model. In any case, please do not post answers if it is not to answer your question. Commented Jun 25, 2020 at 0:27
  • As @GabrielDeLuca mentioned, please edit your question to include these additional information. (There is help page you'll find helpful). Having said that, I will add a comment ->
    – Kazuhito
    Commented Jun 25, 2020 at 8:39
  • It seems your 'Dutch_coastline' layer consists of a lot of smaller segments, and you are trying to link them by get_feature('Dutch_coastline','natural', 'coastline'). Unfortunately it does not help to identify the appropriate segment, because there are lots of the same coastlines in the natural attribute field. Please merge the coastlines to make it one line. My Dutch coastline was taken from Natural Earth dataset.
    – Kazuhito
    Commented Jun 25, 2020 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.