5

I am trying to merge two shapefiles...

Here are the links of two shapefiles

Australian State & Territory

State and Territory ASGC Ed 2011 Digital Boundaries in ESRI Shapefile Format (http://www.abs.gov.au/ausstats/subscriber.nsf/log?openagent&1259030001_ste11aaust_midmif.zip&1259.0.30.001&Data%20Cubes&6E45E3029A27FFEFCA2578CC0012083E&0&July%202011&14.07.2011&Latest)

Australian Suburbs

State Suburbs ASGS Non ABS Structures Ed 2011 Digital Boundaries in ESRI Shapefile Format (http://www.abs.gov.au/AUSSTATS/subscriber.nsf/log?openagent&1270055003_ssc_2011_aust_shape.zip&1270.0.55.003&Data%20Cubes&D68DFFC14D31F4E1CA2578D40013268D&0&July%202011&22.07.2011&Previous)

When I try to merge with QGIS extension MMQGIS.

But it is giving me following error. I try to Google it but can't find something that a newbee can understand.

Error!! Merged layers must all be same type of geometry (polygon != polygon 2.5D)

enter image description here

Can someone explain what exactly this error is and how to fix the problem and merge two files?

1
  • 1
    The error means that one shapefile has X and Y coordinates and the other X, Y, and Z. Before merging you must make convert one or another so that both are either Polygon or PolygonZ type. Read more from shapefile specification esri.com/library/whitepapers/pdfs/shapefile.pdf.
    – user30184
    Commented Sep 22, 2015 at 11:37

4 Answers 4

3

If you still want to work in QGIS then you can do it by importing the shapefiles to GRASS and then exporting them back out again to shapefile. This should convert them both to polygon geometry and the merge will work.

Make sure the two layers are loaded into QGIS before you start.

To import into GRASS:

1. Load the GRASS plugin and the toolbars.
Open the plugin manager (Plugins --> Manage and Install Plugins) and search GRASS in the search bar, ensure that the checkbox is ticked. This should add a new GRASS toolbar to your QGIS window. If it doesn't right click on an empty part of the toolbar; this will bring up a list of toolbars, make sure that GRASS is ticked.

Step 01 - loading the toolbars

2. Create a GRASS workspace.
GRASS doesn't work with data in traditional folders like you would using QGIS with shapefiles. Instead it stores files in a database structure that you have to create before you can start. To do this (adapted from HERE):

In the GRASS toolbar, click on the "New Mapset" icon to bring up the MAPSET wizard. It should automatically create a default save folder in your user folder. Then click Next.

Create new save location

Choose to "create a new location" and call it something - for example 'Australia'. Click Next.

Create new GRASS location

You then need to set the projection. Looking at your data some of it is in GDA94 EPSG: 4283 so I've used this. You can type "4283" into the search bar to filter the list. Click Next.

Setting the projection

Leave the Default GRASS region alone and click Next.

GRASS region

Specify a name for the "mapset" -> I've called it 'Demo'. Click Next. Click Finish.

New mapset name

This should create your location and mapset and set it as the working directory. It should also load the GRASS tools (if it doesn't there is a toolbar button to load the tools). Your now ready to import the files into GRASS.

3. Load the data into GRASS
Open the GRASS tools and look at the Modules Tree. Open File Management -> Import Vector into GRASS and double click on v.in.ogr.qgis - Import Loaded Vector.

GRASS tools

Select one of the files from the dropdown list. Give it a name in the box below - I've just copied the name of the shapefile to make it easier. Click Run. It might take a little while to do, particularly on your complex shapefile. When it's finished you can view it in QGIS by clicking View Output. Repeat this step for the other file.

Run tool

When they're both in QGIS right click on them in the table of contents and select Save As. Save them to a regular folder on your harddrive in shapefile format.

Save As

Redo the join using the two new shapefiles that you've created. I've just tested it with the MMQGIS merge tool and it seems to work fine.

9
  • I prefer this approach as I dont have other software than QGIS. And when I installed QGIS, it has installed with GRASS but I was not able to open it in grass as per the instruction on the link provided. Can you please give me some detail instruction you you managed to do that ? Commented Sep 22, 2015 at 21:53
  • Which version of QGIS are you using? What operating system? Commented Sep 23, 2015 at 8:13
  • I am using QGIS Desktop 2.10.1 with Grass Commented Sep 23, 2015 at 8:15
  • If you can tell me the steps ... I try GRASS GIS 6.4.3 GUI as well instead of QGIS which was installed along with QGIS ... but not able to open any of the shape file and export successfully .. May be I am doing something completely different Commented Sep 23, 2015 at 8:18
  • The QGIS way is probably easier. Just to make sure you have it installed: When you open QGIS Plugin Manager is there a GRASS plugin? Make sure that it is checked. If no toolbars or anything appear you may need to right click on a blank area of the QGIS toolbars to bring up a list of toolbars and ensure that GRASS is ticked. This should bring up a new GRASS toolbar. If that works I'll edit my answer above with some screenshots. Commented Sep 23, 2015 at 8:20
2

You can merge this layers in Geomedia (tested with your data).

  • save .mif like a shapefile (in QGis)
  • open this two shapefiles in Geomedia
  • create new access warehouse
  • output first shapefile to new access warehouse
  • output second shapefile to access warehouse with append option
  • export merged to one shape file
1

While I didn't have the same mismatch in geometry types I found another option. right click on the shape file and select "save as" use the comma separated values format picking the correct geometry then in excel or similar open the 2 exported files and manually match the columns geometry.

Granted it wont work for geometry that needs calculations but did get me out of a bind with a string/real type mismatch

1

In order to ensure the same Geometry type, export each layer with a specific geometry: Right-click on the layer, choose Save As... and select (say) Polygon under the Geometry type box:

enter image description here

You may also want to ensure the same CRS for each exported layer.

This is what the separate layers look like:

enter image description here

Once they're both using the same Geometry type, MMQGIS > Combine > Merge Layers

enter image description here

Now the output resembles

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.