Good morning!
thanks for your input, Ian. Hmm I'm not sure, I agree using commas in
descriptor names is a rather weird thing to do, but actually it's as
valid as any unicode character and we get much more funny things in SHP
columns... Everything works fine except commas, because this class
chooses it as separator for the type spec.
IMO, since it does that, it should make sure not to break anything
related to commas elsewhere in the input string.
In general, I would expect that createType(encodeType(schema)) == schema
is always true, which it currently isn't.
/> But in general you shouldn't be using those simple create functions
in anything except unit tests./
Then it shouldn't be part of the public API - there's no indication /
documentation about this function being only meant for tests. We're
using it as sleek possibility to serialize SimpleFeatureTypes for
persisting them in the DB, it's much simpler than serializing the full
AttributeDescriptors.
Happy to hear opinions.
Cheers,
Matthias
On 1/23/23 17:38, Ian Turton wrote:
On Mon, 23 Jan 2023 at 16:29, Matthias Loeks <matth...@loeks.net> wrote:
Hi all,
I've noticed that org.geotools.data.DataUtilities.createType()
<https://github.com/geotools/geotools/blob/main/modules/library/main/src/main/java/org/geotools/data/DataUtilities.java#L1883>
does not properly map attributed if the name of the descriptor
contains a comma.
Example: Decoding "the_geom:Point,value,%:Double"
yields both "value:String" and "%:Double" attributes, instead of
only "value,%:Double"
Is this behaviour intended for those featureType specs or is this
a bug?
Not sure if using commas in attributed is generally discouraged,
but matter of fact is we're getting customer SHP data with this.
If it isn't outright forbidden to use commas in variable names (it
really should be) it will be in that function - as explained at
https://github.com/geotools/geotools/blob/a4b65151f993702f05b4e4a0e9f053c71243a14e/modules/library/main/src/main/java/org/geotools/data/DataUtilities.java#L1818
the comma separates the feature descriptors. I'm not at all sure that
% is a valid name either. But in general you shouldn't be using those
simple create functions in anything except unit tests. Use a proper
FeatureTypeBuilder and I suspect all your problems will disappear.
Ian
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel