Comments (18)
The GDAL tools use these two internal functions. I've thought before about implementing something similar, so if you want to file a PR, it's going to be appreciated.
from gdal.
from gdal.
I don't know if we can get the driver metadata, so it might not be straightforward.
from gdal.
from gdal.
So here is a crude implementation. It works.
We can probably put it in once_cell
and save a HashMap
if we are likely to call the function a lot. I think we probably won't call this function enough times to justify that, but we can do it.
I looked at the code you linked, those functions seem like they were manually checking for gpkg
, and shp
and not much. But gdal
can handle so many extensions, so there must be something. So we can look at that if this implementation seems very crude.
If you think this is good enough. I can add documentations and other things and make a pull request.
from gdal.
I think think we should keep the logic a little closer to the original. We should probably pass in the filename (because .shp.zip
is annoying to handle and the caller might forget) and check the driver capabilities.
I don't think we should cache the result it since the drivers can be loaded and unloaded at runtime.
from gdal.
Ok, this one is more or less rewriting of the function:
The original one only checks for DMD_EXTENSIONS
but this one checks for DMD_EXTENSION
as well. Other than that it should be similar.
The tests all pass on my laptop, but I don't know if they'll pass on others (if drivers are missing or something).
Since we're checking for DCAP_CREATE
, should we make a Database::create()
function to parallel Database::open()
, and call it from there?
from gdal.
Not sure when I'll be able to look at it properly, but please file a PR so we can keep track of it.
Since we're checking for DCAP_CREATE, should we make a Database::create() function to parallel Database::open(), and call it from there?
But we already have Driver::create_xxx
and.. Dataset::open
, hmm dunno.
from gdal.
Done. It seems to work for my use case. I don't know about other use-cases and edge cases.
from gdal.
I've corrected the suggestions from clippy. Please refer to the comments in the pull request for any other details. I'll correct any errors that might come in the CI once it's been run again.
from gdal.
Commenting here, as I don't think you'll get a notification if I comment on the pull request.
If you're the one approving the CI run, I've updated the code, can you approve the CI tests? It should pass this time. You can feel free to review on your free time, I just wanna make sure I can update it to pass the tests if it fails again. Sorry for the trouble.
from gdal.
Sorry, I do get notifications, but didn't have yet a chance to take a proper look. And I'm a little confused about your GPKG issue, as far as I know, it should work fine on CI (I can see the failure in the Actions history, but have no explanation for it).
Anyway, I just triggered the CI in the PR.
from gdal.
Yeah, I saw that issue, and saw some other tests using gpkg, so I don't understand it either. But the new test should account for that, if GPKG driver is available, but the test is failing somehow, it'll still fail, and I'll look into it. And if it doesn't fail this time, then maybe GPKG driver is not available while running that test.
EDIT: Thank you, I also just figured out how to run CI on my fork, so I can use that for trial and error if they fail again. tests passing locally and failing in CI has made it a bit hard to pin down the error.
EDIT2: the manually triggering the CI run on the fork didn't work, they fail on compiling gdal and other things.
from gdal.
It should be available. I'd still like to figure this out because it might point to a deeper issue, not necessarily in your PR.
from gdal.
It failed again, so the driver is available. could be that the metadata doesn't have .gpkg.zip
. Is there a way to explore easily? maybe a docker image of the CI.. I looked at the metada from my python gdal library to test things.
from gdal.
The CI runs on the ghcr.io/osgeo/gdal:ubuntu-full-X.Y.Z images, you should be able to run Python in those to check.
from gdal.
from gdal.
Found the problem, refer the comment on the pull request. On retrospect, I was thinking, if github didn't cancel other tests and ran all of them, we'd know if it was version problem coz I saw the old ones were the ones that failed. But I didn't say anything. And it turned out to be true lol.
from gdal.
Related Issues (20)
- Change raster and block sizes to `usize`
- Fix issues with `SpatialRef::set_axis_mapping_strategy` API.
- Mutators in `Feature` don't require mutable receiver
- `Feature` fields getters and setters should accept field indexes HOT 3
- FeatureIterator doesn't reset if the iterator isn't completely read HOT 1
- [Feature] Add `DriverIterator` to iterate through the available drivers HOT 1
- Random test suite crash HOT 23
- Can it support macos? HOT 6
- Update OGR arrow example to use arrow-rs
- No iterator support for rasterbands
- Cannot share dataset safely between threads HOT 2
- Error reported when cross compiling on Windows HOT 2
- Discord link not working HOT 1
- is anyone here haved this problem solve? gdal-sys HOT 5
- Cross-compile for aarch64-linux-gnu
- `Polygonize` wrapper HOT 3
- Can `Geometry` be `Send`? HOT 2
- No pre-built bindings available for GDAL version 3.8 HOT 1
- Add Wrapper for OGR_L_Intersection
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gdal.