I'd like to add a List(Map) as Attribute to a SimpleFeature when using the PostGIS datastore:

SimpleFeatureTypeBuilder simpleFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
simpleFeatureTypeBuilder.add("list", List.class);

this causes:

Dec 05, 2019 8:48:51 AM org.geotools.jdbc.JDBCFeatureSource buildFeatureType
WARNING: Could not find mapping for 'list', ignoring the column and setting the feature type read only

Therefore my question is how to I register the mapping properly?


Basically, you can't do that. The PostGIS datastore has no idea how to map a List back into a PostgreSQL or PostGIS type so it ignores the attribute.

Since GeoTools 19.0 there has been support for reading hstore attributes back as a Map, but without trying it I don't know if there is support for writing them. The best thing to try would be creating a table with an hstore column and getting it's FeatureType to see if it contains a map.

  • hstore support seems to be limited to reading, at least in geotools version 20.5. When trying to write something I get the same Warning. – joe_doe Dec 5 '19 at 15:09
  • PR would be welcome then – Ian Turton Dec 5 '19 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.