[Qgis-user] Join multiple Linestrings to single Linestring

Bernhard Ströbl bernhard.stroebl at jena.de
Thu Apr 20 00:11:04 PDT 2017


Hi,
just to clarify things (all info is AFAIK):

1) Processing:
a) processing always creates a new layer as output
b) Dissolve always creates multi features
c) running multi-to-single afterwards creates single features for any 
connecting parts
d) b) and c) can be put into a model to run them in one step
e) Depending on its settings processing processes either the selected or 
all features of the input layer

2) Digitising:
a) works within the current layer and manipulates certain features
b) "merge selected features" creates single features if the lines are 
connected (= endpoints are snapped) and the geometry column is defined 
as Linestring in PostGIS (just tested with QGIS 2.14.13); may behave 
differently for other data providers
c) "merge selected features" deletes all existing datasets and inserts a 
new one; if you want to keep an existing dataset (foreign keys!) use 
DigitizingTools plugin's "merge selected features" instead

Bernhard


Am 20.04.2017 um 08:40 schrieb Fuenfer-Koenigstein.Benjamin at swm.de:
> Hi Richard,
>
> thanks again for your reply! I’m really amazed about the active
> community around QGIS, never experienced that with any other GIS-Software!
>
> ‘Merge Selected Features’ is exactly the tool that I initially wanted to
> use and then realized that it creates multiline-features which causes
> problems with my linestring db table. Meanwhile I will use QAD plugin
> that creates linestring or I will work with a local copy as you suggested.
>
> So for me it works quite OK with this workaround, but maybe it would be
> helpful to have an option to choose between creating multilinestring or
> linestring when using the ‘Merge’ tool. What do others think? Useful and
> important enough to open an issue?
>
>
>
> Regards
>
> Benni
>
>
>
> *Von:*Richard McDonnell [mailto:richard.mcdonnell at opw.ie]
> *Gesendet:* Mittwoch, 19. April 2017 16:02
> *An:* Fuenfer-Koenigstein.Benjamin G-PRA; qgis-user at lists.osgeo.org
> *Betreff:* Re: AW: [Qgis-user] Join multiple Linestrings to single
> Linestring
>
>
>
> Another option, you could try is using the*Advanced Digitising Toolbar*
> under *View, Toolbars
> *Select the lines you want to merge/Join and click *Merge Selected
> Features*.
> This should also allow you to edit the DB directly from QGIS.
> I have not tried it, so your issue with Multi-Lines instead of single
> linestrings may still apply.
> You could still use the above example on the locally saved version of
> the table though and upload and overwrite the changed dataset.
> Sorry I cant be of more help.
> Reagrds,
>
> Richard.
>
> On 19/04/2017 14:07, Fuenfer-Koenigstein.Benjamin at swm.de
> <mailto:Fuenfer-Koenigstein.Benjamin at swm.de> wrote:
>
>     Hi Richard,
>
>
>
>     thanks for your suggestion! I think Dissolve won’t work for me as
>     it’s applied to the whole layer (hope I understood this right). I’m
>     looking for a way to easily merge certain linestrings when I, for
>     example, want to create one geometry by first creating a spline and
>     then a straight line feature. I will try out your workaround with
>     local files. But as the db-source is very large (> 500.000 rows) I’m
>     happy for any other suggestion to solve it directly in QGIS with
>     db-source.
>
>
>
>     Regards
>
>     Benjamin
>
>
>
>     *Von:*Richard McDonnell [mailto:richard.mcdonnell at opw.ie]
>     *Gesendet:* Mittwoch, 19. April 2017 10:10
>     *An:* David J. Bakeman; Fuenfer-Koenigstein.Benjamin G-PRA;
>     qgis-user at lists.osgeo.org <mailto:qgis-user at lists.osgeo.org>
>     *Betreff:* Re: [Qgis-user] Join multiple Linestrings to single
>     Linestring
>
>
>
>     Benjamin,
>     You could try Dissolve, under Geoprocessing Tools, alternatively you
>     could try saving the dataset locally as a shapefile, edit using
>     either of the methods you outlined below, In relation to saving the
>     edits back to the table as linestring, use the DB Manager tool,
>     select the table you wish to update, tick the options you want,
>     making sure both *Replace destination Table (if exists) *and*Create
>     single-part geometries instead of multi-part* This has worked for me
>     in the past, admittedly for polygons, but it should also work for
>     linestrings.
>
>     Hope this helps,
>
>     Richard.
>
>     On 18/04/2017 17:24, David J. Bakeman wrote:
>
>         On 04/18/2017 02:17 AM, Fuenfer-Koenigstein.Benjamin at swm.de
>         <mailto:Fuenfer-Koenigstein.Benjamin at swm.de> wrote:
>
>             Hi there,
>
>
>
>             I want to merge multiple linestrings with same start/endpoint to a single linestring (all lines within one layer). As I use a PostGIS source with geometry type linestring, it is important that the new geometry is still linestring and not multilinestring type. "Merge selected features" tool and "JOIN" in QAD-Plugin both create multilinestrings. Has anyone an idea how to directly merge into linestring or how to change geometry type after merging? Thanks for your suggestions!
>
>         I'm not sure I completely understand what you want but you could run
>
>         multipart to singleparts from the Vector/Geometry Tools menu on the
>
>         multilinestring layer to generate a layer with just linestrings.
>
>
>
>             Best regards
>
>
>
>             Benjamin
>
>             _______________________________________________
>
>             Qgis-user mailing list
>
>             Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>
>             List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
>             Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
>
>         _______________________________________________
>
>         Qgis-user mailing list
>
>         Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>
>         List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
>         Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
>
>     --
>     *_Richard McDonnell_*
>     *GIS Specialist PgD GIS AssocSCSI*
>     *OPW FRM Data Management*
>     *52 Stephens Green, Dublin 2.*
>     TEL: 01 6476543
>
>     Das Bild wurde vom Absender entfernt. <http://www.opw.ie/>
>
>
>
> --
> *_Richard McDonnell_*
> *GIS Specialist PgD GIS AssocSCSI*
> *OPW FRM Data Management*
> *52 Stephens Green, Dublin 2.*
> TEL: 01 6476543
>
> Das Bild wurde vom Absender entfernt. <http://www.opw.ie/>
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>



__________ Information from ESET Mail Security, version of virus signature database 15283 (20170420) __________

The message was checked by ESET Mail Security.
http://www.eset.com





More information about the Qgis-user mailing list