supplying SHAPE_RESTORE_SHX=YES to fiona.open
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 plotly.express.choropleth) 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 fiona.open so that I can open a .shp file without the other files? I tried just doing this:
But it doesn't seem to work.
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
You should be able to pass configuration options to GDAL using fiona.ENV: https://fiona.readthedocs.io/en/stable/manual.html#ogr-configuration-options
According to Wikipedia, at least the shp, shx and dbf files are mandatory: https://en.wikipedia.org/wiki/Shapefile#Shapefile_shape_index_format_(.shx)
GDAL, respectively Fiona is able to read dxf files directly: https://gdal.org/drivers/vector/dxf.html As DXF is not a standard GIS file format, it's probably best to try out what works better.