0

I am creating a storm track using HURDAT2 data which provided by NOAA. Provided Storm track information available in points like below snip (only sample) HURDAT 2 data sample

Earlier with help of Previous version of QGIS plugin these points are converted into lines with all information which showing in attribute snip above.

But in new version of QGIS 3.24.1, plugin is not available and when I am using "Points to Path" option this delete all information between of points like below snip and keeping only first and last point. But I am in need of all information which available for further analysis.

Due to our company policy, we can't install previous version, so I have to use this updated version only.

AFter Points to path operation in QGIS

Please suggest view on this. I have basic understating of R as well if anyone would like to suggest using R.

3
  • What is the plugin that you are talking about? Generally a line is one feature that can have one row of attributes. So it can have an attribute "windspeed" but that can only have one value. It is not possible to keep all the values from the pointwise observations. It feels like the plugin that you have used has made a linestring but also kept the original points with the native attributes. Perhaps the plugins has also presented the two layers in some user friendly way.
    – user30184
    Sep 4 at 10:37
  • Points to Paths was the Plugin which i used earlier and this gives me attributes segment wise. Like if Point A has 98mph wind speed so line starts from that point till next point will 98mph and after this Point B value starts same goes till the end.
    – Raj
    Sep 4 at 10:55
  • It is possible to use a "Path group expression" in the Points to Path tool. Question gis.stackexchange.com/questions/418257/… is about how to usegrouping. But maybe you are rather after something that does not exist yet github.com/qgis/QGIS/issues/40677. Still when you combine points to lines you will lose some information.
    – user30184
    Sep 4 at 11:40

1 Answer 1

1

For this I would recommend using a Virtual Layer (Database --> DB Manager --> Virtual Layers --> Project layers). The cool thing about it is that you would automatically update your line layer whenever a new point is added.

Lets say you have a layer points with attributes windspeed, stormid and time. A virtual layer definition would look like this (You would need to adapt the query accordingly to your data):

SELECT 
    row_number() over() as id,
    windspeed,
    windspeed2,
    stormid,
    setsrid(make_line(geometry, geometry2),4326) as geometry
FROM (
  SELECT 
    windspeed,
    lead(windspeed) OVER w AS windspeed2,
    stormid,
    time,
    geometry, 
    lead(geometry) OVER w AS geometry2
  FROM 
    points WINDOW w AS (PARTITION BY stormid ORDER BY time) 
) as q
WHERE geometry2 IS NOT NULL;

virtual layer creation

Explanation:

  1. Most important: the window function partitions your raw data by stormid and orders the vertices by the time property.
  2. The geometry of the next vertex and the windspeed is accessed using the lead function using the window.
  3. The outer query creates the line using make_line and adds a unique id using row_number().

Auto-update of lines when adding new data: auto-update lines

Your Answer

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

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