2

I have a line shapefile where I need to break the line at the specific intersection with points using QGIS 2.18.20. I refer to these segments as ‘tray sections’.

Now I need to have two fields: f_from and f_to in the ‘tray sections’. In these fields, I need to calculate the specific label from the point layer ie a specific ID number. I also need to have x and y fields for the f_from and x and y for the f_to as well.

Eg. See screenshot below: enter image description here

  • Are your points topologically related with your lines? As in, do your point features sit perfectly within the same space as your line features? – RobinHorner Sep 21 '18 at 5:55
  • Some do, and some do not @RobinHorner – geogeek-pkav Sep 25 '18 at 13:58
1

QGIS 2.18.20 ... ! partial answer !

This is probably not an answer you have anticipated, but anyway...

  • This is a Virtual Layer approach, you may / may not be familiar with.
  • As of today, latest QGIS versions (both 3.2.3 and 2.18.24) have some unknown problems with the Virtual Layer. You would have to stick with your QGIS 2.18.20.

A virtual layer syntax is:

SELECT nodes.id AS f_from_to, 
       st_x(nodes.geometry) AS x, 
       st_y(nodes.geometry) AS y, 
       line.* 
FROM nodes
CROSS JOIN line
ON st_intersects(st_buffer(nodes.geometry, 10), 
                 st_geometryn(line.geometry, 1))

enter image description here

Another caveat:

  • This syntax does not distinguish f_from and f_to (you will notice I have f_from_to field, which is mixture of two). Hopefully SQL experts help us to fix it).

So sorry for this premature one, hopefully for your for for thought.

  • Hi @Kazuhiot, thanks. Can I get your email to send the workflow I have so far? A bit to long to add in the comment section. – geogeek-pkav Sep 24 '18 at 22:53
  • @geogeek-pkav Is it possible for you to edit your question and add your workflow? You will see some questions at this site, especially complex ones, have been edited/updated as going toward solutions. Thanks! – Kazuhito Sep 25 '18 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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