Well, Problem solved. I simply switched to String-Color-Representation
instead of Java-Objects.

Best
Julian

Am Wed, 4 Nov 2015 13:56:51 +0100
schrieb Andrea Aime <andrea.a...@geo-solutions.it>:

> On Wed, Nov 4, 2015 at 1:26 PM, Julian Hagenauer
> <julian.hagena...@gmx.de> wrote:
> 
> > Hi,
> >
> > I have a colum named "color" in my FeatureType which stores
> > instances of Color.class. Now, I am trying to save my
> > FeatureCollection of this type to a Shapefile and get the following
> > exception:
> >
> > java.io.IOException: Unable to write column color : java.awt.Color
> > at
> >
> > org.geotools.data.shapefile.ShapefileDataStore.createDbaseHeader(ShapefileDataStore.java:365)
> > at
> >
> > org.geotools.data.shapefile.ShapefileDataStore.createSchema(ShapefileDataStore.java:262)
> > at
> >
> > org.geotools.data.shapefile.ShapefileDataStore.createSchema(ShapefileDataStore.java:71)
> >
> > My questions:
> > Is it ok to store more complex objects like java.awt.Color in a
> > column? 
> 
> No, DBF cannot store colors, you won't be able to get them back
> anyways
> 
> 
> > Is it somehow possible to save these?
> >  
> 
> Treat them as strings, usual HTML hex encoding, e..g 0xFFAA00
> 
> How can I convert the objects to something simple like a string (maybe
> > a hex-colorcode) before saving the FeatureCollection?
> >  
> 
> I guess you can write your own feature collection decorator extending
> FeatureCollectionDecorator
> 
> Cheers
> Andrea
> 


------------------------------------------------------------------------------
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to