[Qgis-user] Batch selection/new feature creation

Samuel Williams sam.williams at sineenvironmental.com
Thu Sep 17 05:05:33 PDT 2020


Jeroen,
Thank you, that's a great approach that I hadn't thought of. I'll upload
the layer to postgres and do as you suggest!
Thanks again,


Sam.

Sam Williams

Director | *Sine Acoustics*
m. +447969123431 <%2B44%207969%20123431>|Sam.Williams at sineenvironmental.com
| www.sineenvironmental.com
Sine Acoustics is a trading name of Sine Environmental Limited, company
number 9609805. Postal address: 78 Old Church Road, Clevedon, North
Somerset, England, BS216PT.


On Thu, 17 Sep 2020 at 11:35, Groene Bij <mail at groenebij.nl> wrote:

> Hi,
>
>
>
> Have you considered using postgis for this?
>
> See:
> https://gis.stackexchange.com/questions/17495/dissolve-or-unsplit-lines-on-common-attributes-in-postgis-or-grass
>
>
>
> First step would be to add the reference id from the spreadsheet to the
> polyline layer.
>
> Polyline layer with the 100m stretches, “polyline”
>
>
>
> Csv with sections, “tracks”
>
>
>
> So, to add ref_id to each polyline you can use:
>
> SELECT p.*, t.ref_id
>
> FROM polyline as p
>
> JOIN tracks as t
>
> ON p.ch_1 >= t.start_ch AND p.ch_1 < t.end_ch
>
>
>
> Than you can dissolve all polylines with the same ref_id like in the
> example link.
>
>
>
> You can  combine al subqueries and export the result as new layer to your
> qgis-canvas.
>
>
>
> That leaves the ‘saves these resulting new feature to an existing layer’
> part.
>
> You can merge features from different layers into a new or existing layer.
>
>
>
> Greetings,
>
> Jeroen Hovens
>
>
>
>
>
> *Van:* Qgis-user <qgis-user-bounces at lists.osgeo.org> *Namens *Samuel
> Williams
> *Verzonden:* donderdag 17 september 2020 11:14
> *Aan:* Qgis-user at lists.osgeo.org
> *Onderwerp:* [Qgis-user] Batch selection/new feature creation
>
>
>
> Hello,
> I'm hoping that those with more experience of QIS might be able to help
> point me in the right direction.
> I have a layer consisting of around 700 end-to-end polylines, each of
> which represents a 100m stretch of railway track centreline. Each polyline
> is attributed with an integer value which represents its starting chainage
> (distance in m from the start of the railway line, abbreviated ch.).
> I also have a spreadsheet/csv with several hundred rows, each of which
> represents a different section of the railway. These sections are defined
> by their start and end chainage (e.g. ch. 1300 to ch. 1800 would be a 500m
> stretch starting 1300m from the beginning of the line).
> I am looking for an efficient way to select each of the polylines
> associated with each row in the spreadsheet, dissolve them (they should
> touch end to end), and then save them as a new feature on an existing
> layer. Each one will need to be given a reference ID from the relevant line
> in the spreadsheet.
> E.g.
> Row 1 of spreadsheet selects all polylines with a starting chainage 1300
> to 1700 (which with 100m segments selects the whole length 1300-1800),
>  dissolves them, populates the ID field from a field in the spreadsheet,
> and finally saves these resulting new feature to an existing layer.
> This process would then repeat for the other rows in the spreadsheet/csv.
> I’ve got a reasonable understanding of python,  but have never tried using
> it within qgis. Would that be the easiest route, or is there a way of
> using v.extract in batch mode which reads each of the required selections
> from the spreadsheet? From the grass manual v.extract appears to read
> selections from a text file, but I can't find any good examples, or detail
> in the manual on the required format for the text file.
>
> Any help much appreciated!
>
> Kind regards,
>
>
>
> Sam.
>
> Sam Williams
>
> Director | *Sine Acoustics*
> m. +447969123431 <%2B44%207969%20123431>|
> Sam.Williams at sineenvironmental.com | www.sineenvironmental.com
> Sine Acoustics is a trading name of Sine Environmental Limited, company
> number 9609805. Postal address: 78 Old Church Road, Clevedon, North
> Somerset, England, BS216PT.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200917/b33a9452/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 3697 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200917/b33a9452/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 2016 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200917/b33a9452/attachment-0003.png>


More information about the Qgis-user mailing list