I have the split shapefiles like same size tiles. I want to show these merged on QGIS.

So, I tried to use Virtual Layer like following image. enter image description here

And, I wrote following SQL:

select * from north
select * from central
select * from west

But, the boundary line of shapefile shown. I want this,

enter image description here

In this case, how do I write SQL?


you have to UNION the geometry with ST_UNION and grouping the geometrys by one or more unique fields. The statement should be like this one (where name is the unique field/identifier in the example below):

SELECT ST_UNION(geometry), name FROM 
SELECT central.geometry, name FROM central 
UNION SELECT north.geometry, name FROM north 
UNION SELECT west.geometry, name FROM west

1) If the structure of your input data is the same, you were very close:

select * from "north" UNION ALL select * from "central" UNION ALL select * from "west"

2) Now you need to connect sub-polygons that only touch the cut lines with an operator where with explicit identifiers, for example:

update union_table set geometry=ST_UNION(geometry) where union_table.ID =1 or union_table.ID =2...

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.