• Blog posts



    How do I resolve the ‘The Input has “Z”’ error message?





    This MapThat message occurs when MapThat is trying to load a layer from PostGIS that contains 3D Multistring geometry. To check if your PostGIS table has 3D geometry, in PGAdmin you can use SQL to return the geometry type of your records. The SQL statement to use is:

    Select st_astext(geom) from yourtablename

    PGAdmin now lists the geometry type of your records, and in this case the geometry type is Multilinestring ZM. 

    MapThat can only read 2D geometry so you will need to transform the geometry into 2D objects. There are a number of ways to do this.


    Method 1: Update the Geometry from 3D to 2D in PostGIS

    You can use a SQL script to change the geometry of the records from 3D to 2D. The SQL statement to use is:

    Alter Table yourtablename

    Alter Column geom TYPE geometry(MULTILINESTRING, 27700)

    Using ST_Force2D(geom)

    PGAdmin now lists the geometry type of your records, and now the geometry is 2D Multilinestring. (Note that the 27700 value in the SQL script will be based on the SRID of your data.) 


    However, while this has edited the geometry of the records, the geometry type of the GEOM column in the table properties is still set to 3DGeometry type.



    Method 2: Export the Spatial data from QGIS as 2D geometry

    In this case, it would be better to first save the 3D geometry source file, as a Shapefile with 2D geometry which can then be loaded into your PostGIS database.

    When saving/exporting a Shapefile in QGIS you can change the Geometry to be 2D by unticking the ‘Include z-dimension’. To do this, change the Automatic option to LineString, then untick the ‘Include z-dimension’ option and then change the type back to Automatic.


    If you now import this new Shapefile file into PostGIS using the QGIS DB Manager > Import Option, the Column type for the Geom field will now be Multilinestring and not MultilinestringZM.