-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error creating a gdb file with OpenFileGDB driver #392
Comments
Which GDAL version are you running? |
I'm running gdal 3.6.4 |
Changing this line to OpenFileGDB results in the same error: https://github.com/georust/gdal/blob/master/src/vector/layer.rs#L1210 |
This is what I get for
|
This works fine in c++ #include <iostream>
#include <ogr_api.h>
#include <gdal_priv.h>
int main() {
const char *pszDriverName = "OpenFileGDB";
GDALDriver *poDriver;
GDALAllRegister();
poDriver = GetGDALDriverManager()->GetDriverByName(pszDriverName);
if (poDriver == NULL) {
printf("%s driver not available.\n", pszDriverName);
exit(1);
}
GDALDataset *poDS;
poDS = poDriver->Create("sample.gdb", 0, 0, 0, GDT_Unknown, NULL);
if (poDS == NULL) {
printf("Creation of output file failed.\n");
exit(1);
}
return 0;
} |
Does I think we're playing a bit fast and loose with the |
Sorry, yeah with GDT_Byte I'm getting the same error: Only vector datasets supported |
Yeah, we're picking |
Other drivers seem to work, I've found only OpenFileGDB breaking |
If I change that argument to 0, which I assume is GDT_Unknown gdb file gets created, but I get: |
In the Rust or C++ version? It was working before in C++ with |
Works in c++, error's in rust, I'm updating this test https://github.com/georust/gdal/blob/master/src/vector/layer.rs#L1210 on the master branch |
This is what I have changed here: https://github.com/georust/gdal/blob/master/src/driver.rs#L208 let c_dataset = unsafe {
gdal_sys::GDALCreate(
self.c_driver,
c_filename.as_ptr(),
0,
0,
0,
0,
null_mut(),
)
}; |
That's okay. The let mut layer = ds
.create_layer(crate::LayerOptions {
name: "test",
srs: None,
ty: OGRwkbGeometryType::wkbPoint,
options: None,
})
.unwrap(); should work, assuming you update the rest of the test (extensions and removal at the end). |
Yeah that works, do you want me to create a pr for this change? Thanks a lot for your help. |
You can't change it directly to For a minimal change, you can make |
Of course, I was thinking of creating a new function for vector datasets, since they don't use any of those options, but I can also add |
I think Don't bother with the test, it will cause problems on older GDAL versions. Or you can gate it with a |
Ok, thanks |
@lnicola Perhaps I'm missing something but removing the generic seems too disruptive when I looked at the code in more detail. Perhaps I can add a case for u128 and treat it as GDT_Unknown. Or write a new function just for vector creation. |
393: Pass `GDT_Unknown` for vector layers r=metasim a=lnicola - [x] I agree to follow the project's [code of conduct](https://github.com/georust/gdal/blob/master/CODE_OF_CONDUCT.md). - [x] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users. --- Closes #392 Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
I wanted to file this against GDAL, but noticed there's an OpenFileGDB raster driver in 3.7, and CC @rouault just in case. TL;DR we noticed that creating vector OpenFileGDB datasets was failing in 3.6 because we were passing |
Trying to write to a file with OpenFileGDB driver returns this error:
GDAL method 'GDALCreate' returned a NULL pointer. Error msg: 'Only vector datasets supported'
.This is the abbreviated version of how I'm creating a gdb file:
There are no errors when using proprietary
FileGDB
driver, butOpenFileGDB
should support this operation starting from 3.5 versionThanks
The text was updated successfully, but these errors were encountered: