geopandas / pyogrio

Vectorized vector I/O using OGR
https://pyogrio.readthedocs.io
MIT License
272 stars 22 forks source link

DOC: mention option of prefixing a path with the driver in ogr_open exception #313

Closed theroggy closed 11 months ago

theroggy commented 11 months ago

As most drivers seem to support this, it might be practical to suggest this option when a file cannot be opened?

For writing, the driver detection doesn't support this at the moment, and gdal doesn't seem to support this either for writing... so where it is probably easier to just keep using the driver parameter.

reference #310

theroggy commented 11 months ago

Yes, it is supported for quite some formats, but definitely not for all, so it is definitely not a good idea to advice the user to structurally specify the driver this way...

While testing some things I indeed also noticed that for some formats gdal also does some automatic detection even if the extension isn't correct... so I think it isn't easy to give advice beyond "if reading a file doesn't seem to work, try specifying the driver like this."

This is why I thought it was a good idea to give the advice in the exception, then the user is in a situation that it is useful to try if he can solve his problem by specifying the driver like this.

Obviously this doesn't mean it isn't useful to mention this in the documentation somewhere as well. I might be wrong about this, but I interpreted the "introduction" rather like a quick-start. If this is a correct interpretation, I'm not sure if it is the ideal place to document something 99.9% of users probably won't ever encounter?

Maybe the error handling page could be renamed to "Troubleshooting" and some info about this could be added there?

Another alternative is to add it as a note in the API reference doc of the functions where he can encounter this, so all read functions and list_layers.

brendan-ward commented 11 months ago

so it is definitely not a good idea to advice the user to structurally specify the driver this way

Good point. Let's leave this out of the documentation for now until there is additional demand / confusion around this; having it in the error handler only seems reasonable for now.