PostGIS – Solving Errors When Using pgsql2shp for Shapefile Export

exportpgsql2shppostgisshapefile

I try to export geographical data from a postgis database to a shapefile with pgsql2shp.

Normally this works fine, but now I receive the following error.

Preparing table for user query... Done. 
Initializing... ZMflagQuery: ERROR:  function zmflag(geometry) does not exist
LINE 1: SELECT max(zmflag("geometrie"::geometry)) FROM "__pgsql2shp7...

The query I use is:

pgsql2shp.exe -f 'foldername' -h luna -p 5432 -u user-P pw -g geometrie dbname "select * from bag.adressen a where a.wnpcode = '3386'"

I haven't had any earlier problems with pgsql2shp.

Best Answer

PostGIS 2.0 doesn't have the function zmflag(geometry). It is now known as st_zmflag(geometry). I'm betting that the version of pgsql2shp is from a prior version of PostGIS. You can check with

pgsql2shp -?

At the top of the output, it should list the release version. Something like...

RELEASE: 2.1.0SVN (r10420)
Related Question