3

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

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.

  • When I do singleparts to multiparts I only get an empty shape file – user16032 Nov 16 '15 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 '15 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 '15 at 0:33
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.

  • 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 '15 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 '15 at 0:16
  • (it should return 1 if it succeed or 0 if it fails) – mgc Nov 17 '15 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 '15 at 0:28

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.