4

Is it possible to transform a point shapefile in single part geometry to a shapefile with multi-point geometry based on an attribute. e.g. in the file are 50.000 records in 700 categories, now I want to create a multi-part geometry point file.

The result should be a shapefile with 700 records (=categories in the former shape).

Is this possible in QGIS, Spatialite or something else?

3 Answers 3

4

I believe you can do this through default top menu:

Vector - Geometry Tools - Singleparts to Multipart...

Though above the input there is written "Input line or polygon vector layer" I just tested it with point layer and it did work.

Also once you create multipoint layer to edit - add / delete parts (point from multipoint) you need to use Advanced Digitizing (right click on top bar to activate it) and use tools Add Part / Delete Part.

4
  • When I do singleparts to multiparts I only get an empty shape file
    – user16032
    Nov 16, 2015 at 23:55
  • @user16032 I just checked with another file and it worked smooth again, are you sure you are doing it on the proper column and there are no null values in that column (which might cause issues)?
    – Miro
    Nov 17, 2015 at 0:25
  • there was one hidden NULL, never checked, seems to works now, incredibel slow but it works. thanks a lot for the tip with the NULL!
    – user16032
    Nov 17, 2015 at 0:33
  • It appears that the "Singleparts to Multiparts" function doesn't exist in version 3.8 or higher.
    – stevevance
    Feb 28, 2020 at 14:38
2

Yes I guess it is possible (with spatialite at least). In spatialite for example you probably can do something like:
CREATE TABLE yournewtable AS SELECT group_concat(foo), CastToMultiPoint(Gunion(GEOMETRY)) FROM your50000recordstable GROUP BY your700categories_column
which should result in 700 multipoint features (1 per category), with GEOMETRY as your geometry column and where group_concat(foo) will take the value of foo column for each record of each category and concatenate them.

4
  • The creation of the table works, categories are ok, but when loaded in Qgis the geometry column is empty / NULL. any idea why? thanks a lot!
    – user16032
    Nov 17, 2015 at 0:03
  • Did you recover the geometry column after the CREATE statment ? If not you should : SELECT RecoverGeometryColumn('your_table', 'GEOMETRY', the_srid, 'Multipoint', 'XY');
    – mgc
    Nov 17, 2015 at 0:16
  • (it should return 1 if it succeed or 0 if it fails)
    – mgc
    Nov 17, 2015 at 0:24
  • Tried something around, it worked via "Create table newtable as select distinct (Category), aswkt(casttomultipoint(gunion(geometry))) FROM Database Group by (Category)" and then import in Qgis. thanks lot!
    – user16032
    Nov 17, 2015 at 0:28
0

Vector - Geometry Tools - Singleparts to Multipart... this pluging doesn´t exist more for the QGIS new versions. What do you have to do? Create a new column and concatenate records with categories and them dissolve this column, result a new shape multipoint, that's all.

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Nov 9, 2022 at 15:52

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.