Project

General

Profile

Bug #7536

Migrate pyshp to fiona

Added by Philippe May over 5 years ago. Updated about 5 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Target version:
-
Start date:
02/02/2019
Due date:
% Done:

0%

Close

Description

At a user level: error 500 is reported.

Looking at the logs: issue with the shapefile python module:

  File "/usr/local/lib/gisaf_src/gisaf/models_base.py", line 755, in get_shapefile_writer
    writer = ShapeFileWriter(cls.shapefile_model)
  File "/usr/local/lib/venv/gisaf_python3.7/lib/python3.7/site-packages/shapefile.py", line 1017, in __init__
    self.shp = self.__getFileObj(os.path.splitext(target)[0] + '.shp')
  File "/usr/lib/python3.7/posixpath.py", line 122, in splitext
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not int

Associated revisions

Revision 0aff7172 (diff)
Added by Philippe May over 5 years ago

Workaround for #7536 (downgrade pyshp version)

Revision b285885b (diff)
Added by Philippe May about 5 years ago

Refs #7536: attempts using fiona for exporting shapefiles and attempt to use fiona's MemoryFile, not conclusive, refactoring

History

#1 Updated by Philippe May over 5 years ago

  • Status changed from New to In Progress

pyshp (the Python library used for generating shapefiles) was updated by mistake to 2.0.1, which is a breaking change. See https://github.com/GeospatialPython/pyshp/releases and the README at https://github.com/GeospatialPython/pyshp.

For now, i reverted pyshp to the old version 1.2.12, which solves the issue.

Keeping this ticket open: should update gisaf to match the specs for the new version.

#2 Updated by Philippe May over 5 years ago

  • Subject changed from Cannot export shapefiles to Migrate pyshp to 2.0.1

#3 Updated by Philippe May over 5 years ago

  • Subject changed from Migrate pyshp to 2.0.1 to Migrate pyshp to fiona

fiona would be preferred, as it can deal with almost any GDAL/org format, integrates nicely with geopandas, and it's used already for geopackage and dxf formats. I couldn't understand how to deal with shapefiles properly, but that's probably me.

So, let's keep pyshp as-is, and rename ticket.

#4 Updated by Philippe May about 5 years ago

  • Status changed from In Progress to Rejected

Not worth banging my head on this: shapefiles should be considered deprecated in favor of Geopackage.

Also available in: Atom PDF