Ricky Teachey

Hello: I hope this is the right place to ask a question.

I am trying to figure out how to open a .shp while without all the other accompanying files. I THINK want to do this because I believe I don't care about the data in those other files. However I'm also a total beginner in usage of shape files so please let me know if I am wrong about what it is I believe.

My belief is that the geometric information- basically, the XY coordinates- of the shapes I intend to plot (using and turn into a little app for my own use is contained in the .shp file. These .shp files are being created for me in Autocad by a coworker; they are not actually maps of any kind, just a bunch of shapes, and .shp is a much more convenient way to save them than .dxf.

I understand that most of the time, you will pass shape files around with other files, such as .shx, and Autocad does create these files. However it would be easier to not worry about these other files for my purposes.

It appears it is possible to do what I want to do by supplying the option of SHAPE_RESTORE_SHX=YES to GDAL. However, I'm trying to do this using a python script with fiona, and not using the CLI.

Assuming what I am wanting to do makes some kind of sense, is there a way to supply the SHAPE_RESTORE_SHX=YES directive to so that I can open a .shp file without the other files? I tried just doing this:, SHAPE_RESTORE_SHX="YES")
But it doesn't seem to work.

Python 3.8.1
Windows 10
Fiona 1.8.13
GDAL 3.0.4
Installed using the wheels at Christoph Gohlke's web page


"I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler

René Buffat

You should be able to pass configuration options to GDAL using fiona.ENV:

According to Wikipedia, at least the shp, shx and dbf files are mandatory:

GDAL, respectively Fiona is able to read dxf files directly: As DXF is not a standard GIS file format, it's probably best to try out what works better.

lg rene