Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
You'll want to provide more information before anyone can give an informed answer. What is the output from: SELECT postgis_full_version(); – dustymugs Oct 12 '12 at 1:41
Output for SELECT postgis_full_version() = "POSTGIS="2.0.1 r9979" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.1, released 2012/05/15 GDAL_DATA not found" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER" – Stefan Oct 12 '12 at 7:54
up vote 8 down vote accepted

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)
share|improve this answer
Thanks for your help. – Stefan Oct 15 '12 at 7:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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