Closed tjwebb closed 2 years ago
In case anyone else runs into this issue, this is a pretty clean workaround:
json.dumps(record.__geo_interface__, default=str)
Nice workaround @tjwebb! This has now been fixed in https://github.com/GeospatialPython/pyshp/commit/7ef3456521be80c699d06d802adec176ca2b9169, and will be available in the next version.
This is fixed in the latest v2.2.0.
This simple example fails:
result:
If I want the bona fide date object, that is already available in the record. But if I'm using
__geo_interface__
, it's because I want to serialize it into geojson.__geo_interface__
is trying to be too clever for its own good.GDAL's
.ExportToJson()
simply writes the date as a string in theproperties
hash.