I have created a shapefile with approximately 300 feature of shapeType POINTZ. I can fill my attributs and define point. Here is my function that i call for each feature:

def upd_shp(fn, geo, attr):
    r = shapefile.Reader(fn)
    w = shapefile.Writer(r.shapeType)
    w.fields = list(r.fields)
    x = geo[1]
    y = geo[0]
    z = geo[2]
    w.point(x, y, z)

Then when i do ogrinfo -al myshp.shp i can see POINT (8.833808735269852 42.540690712189829) but there is not 'z' value. When i do ogrinfo -al example.shp which it's a shapefile made by my company i can see POINT (8.75044460305986 42.567946874150579 37.384099928078562).

I know my 'z' is in the shapefile but i don't understand why i can't see it with ogrinfo.

I searched and I found Creating and reading z values (coordinates) with pyshp? but it did not help me much.

I would like to know if i'm missing something?

  • Are you sure that you are creating the shapefile with a type of POINTZ (does ogrinfo report that)? You may need to include some of the code for that. Commented Jun 19, 2018 at 14:32
  • Yes i'm sure, this is the code for the shapefile creation def first_shp(fn): ff = os.path.isfile(fn) if ff is False: ww = shapefile.Writer(shapeType=11) for x in attr_list_full: ww.field(x) ww.save(fn) and to be sure it's POINTZ : >>> import shapefile >>> r = shapefile.Reader('/myshp/attr_def.shp') >>> r.shapeType 11
    – Bazinga
    Commented Jun 19, 2018 at 14:39

1 Answer 1


You need to set the shapeType when creating the point.

w.point(x,y,z, shapeType=shapefile.POINTZ)

Looking at the source, the shapeType parameter of point defaults to POINT:

def point(self, x, y, z=0, m=NODATA, shapeType=POINT):
    """Creates a point shape."""
    pointShape = Shape(shapeType)

The docs does also states that, although it's not exactly clear as it could be.

An optional z (elevation) and m (measure) value can be set if the shapeType is PointZ or PointM.


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.