question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A property named "time" raises DriverSupportError for ESRI Shapefiles

See original GitHub issue

Expected behavior and actual behavior.

From https://github.com/Toblerity/Fiona/issues/572, I see that properties of type datetime.time are not supported for ESRI Shapefiles, but surely a str property named “time” is acceptable?

Fiona raises DriverSupportError: ESRI Shapefile does not support time fields for schemas that have a property named “time”.

Steps to reproduce the problem.

Running this code:

import fiona

schema = {
    "geometry": "Point",
    "properties": {
        "time": "str",  # type is str, should be okay
    }
}

c = fiona.collection("time_bug.shp", "w", "ESRI Shapefile", schema)

Gives this result:

Traceback (most recent call last):
  File "/vagrant/fiona_time_bug.py", line 13, in <module>
    c = fiona.collection("time_bug.shp", "w", "ESRI Shapefile", schema)
  File "/opt/DataPortal/lib/python3.6/site-packages/fiona/env.py", line 405, in wrapper
    return f(*args, **kwargs)
  File "/opt/DataPortal/lib/python3.6/site-packages/fiona/__init__.py", line 263, in open
    **kwargs)
  File "/opt/DataPortal/lib/python3.6/site-packages/fiona/collection.py", line 145, in __init__
    self._check_schema_driver_support()
  File "/opt/DataPortal/lib/python3.6/site-packages/fiona/collection.py", line 419, in _check_schema_driver_support
    raise DriverSupportError("ESRI Shapefile does not support time fields")
fiona.errors.DriverSupportError: ESRI Shapefile does not support time fields

Operating system

Linux-3.10.0-514.el7.x86_64-x86_64-with-centos-7.3.1611-Core Python 3.6.5

Fiona and GDAL version and provenance

Installed from PyPI via pip:

Fiona 1.8.3 GDAL 2.3.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
snorfalorpaguscommented, Dec 7, 2018

I think this should be:

for field in self._schema["properties"].values():
1reaction
sgilliescommented, Dec 7, 2018

@mdklatt yes, you’re right. We’ll fix this in the next release. Next week, I think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem exporting geodataframe to Esri shapefile having ...
I had a geodataframe having 4 columns (viz. name, time, description, geometry fiels). I am ...
Read more >
Number of shapes does not match number of table records
The following error occurs when adding a shapefile to an ArcMap Data Frame: Error: Number of shapes does not match number of table...
Read more >
pyshp - PyPI
The Python Shapefile Library (PyShp) provides read and write support for the Esri Shapefile format. The Shapefile format is a popular Geographic Information ......
Read more >
pandas geodataframe to shapefile, fixing datetime error
I have a geopandas dataframe and I am trying to export it to an ESRI Shapefile. herds_projectplan_ply.to_file(gdb_path ...
Read more >
Shapefiles in ArcGIS Pro—ArcGIS Pro | Documentation
Here, edits are being made to a shapefile layer named Building. Deleting unnecessary fields. Adding a new field named BLDGTYPE. Changing the layer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found