-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
How to use the OFTStringList field type? #47
Comments
This is the low level set call, I don't see anything here that would handle OFTStringList correctly:
Seems like the only supported types are numbers, strings, and null/undefined (to unset). I think it would be a good addition to make sure all types we support reading are also supported writing. For your specific case you would need to check if the JS value is an array of strings, then cast/pass it to this https://gdal.org/api/ogrfeature_cpp.html#_CPPv4N10OGRFeature8SetFieldEPKcPPCKc - the lift should not be too bad if you want to send a PR. |
@contra I am not very sure if it is really useful - complex data types are considered exotic and while reading them is supported as they can be encountered - it is still best to not write them. You will either end producing incompatible output, or the driver will eventually stringify the object the way it sees it right. |
Are these datatypes part of some sort of standard? |
Every format defines its own datatypes and then there is the GDAL level abstraction which tries to match them as closely as possible. The scalar types and the string are universal, but the list types are much less so - for example given that GeoJSON is in fact a JSON, you can always try to squeeze an array (or worse, an object) into the But still, as GDAL does support writing those list types, a PR for them would still get merged. It is just that there is a reason it was not made in the first place and unless you are going to be the only reading those files, you should probably avoid it. If you are making a PR, just make sure to convert the UTF16 from V8 to UTF8 for GDAL. There are many examples in the code. |
@bkeevil I'm going to leave this open since this is a feature request we want to implement |
I was trying something like:
but feature.fields.set() won't accept an array of strings
What is the correct way to use the OFTStringList field type? I can't find any documentation or examples anywhere.
The text was updated successfully, but these errors were encountered: