Hi Justin, I ran now testEncodeFeatureCollection(), unfortunately I do get the same error. Perhaps I still do something wrong with my POM file. I checked manually the contents of the featureCollection and it contains SimpleFeatures exclusively.
This is the error message: 3, 2008 11:39:11 AM org.geotools.xml.impl.GetPropertyExecutor visit WARNING: [EMAIL PROTECTED] (org.geotools.feature.DefaultFeatureCollection$1) is not of type org.opengis.feature.simple.SimpleFeature Any hint is highly appreciated. Best regards Theodor > -----Original Message----- > From: Justin Deoliveira [mailto:[EMAIL PROTECTED] > Sent: Friday, May 09, 2008 12:58 AM > To: Theodor Foerster > Cc: GeoTools Devel List > Subject: Re: [Geotools-devel] KML Writer in Geotools > > Hi Theodor, > > This is odd... can you tell me exactly what the > implementation class of the FeatureCollection is? I ask > because the FeatureCollection interfaces extends > SimpleFeature... so it should be a safe cast... or so i would think. > > Also, I added a test case to KMLParsingTest called > testEncodeFeatureCollection(), which should test this case. > Can you run it and see if it passes for you? > > -Justin > > Theodor Foerster wrote: > > Hi Justin, > > Thanks for your hint. Somewhat the gt repository structure seems to > > change. Anyway, I just tried to encode a FeatureCollection as KML. > > Unfortunately I do get an error (java.lang.ClassCastException) in > > org.geotools.kml.binding.FeatureTypeBinding:185. The object > passed in > > getProperty() is not of type SimpleFeature but of type > > FeatureCollection. I call the encoder via encoder.encode(fc, > > KML.Document, System.out) also using the Qname KML.kml > results in the > > same error. Any help is appreciated. > > > > Theodor > > > >> -----Original Message----- > >> From: Justin Deoliveira [mailto:[EMAIL PROTECTED] > >> Sent: Wednesday, May 07, 2008 7:39 PM > >> To: Theodor Foerster > >> Cc: GeoTools Devel List > >> Subject: Re: [Geotools-devel] KML Writer in Geotools > >> > >> Hi Theodor, > >> > >> I think you are getting bit by the recent change in > geotools artifact > >> names, change your dependency on kml to: > >> > >> <groupId>org.geotools.xsd</groupId> > >> <artifactId>gt-kml</artifactId> > >> > >> That should pick up the new changes. > >> > >> -Justin > >> > >> Theodor Foerster wrote: > >>> Hi Justin, > >>> Thanks for putting so much effort into this. I tried to run > >> my prior > >>> code for KML encoding (see snippet in one of the emails > below), but > >>> still do not get any KML stuff generated. I am using gt-2.5 > >> SNAPSHOTs > >>> from gt's maven repository and I am not sure, if they are > >> up-to-date. > >>> For kml I include the gt2-xml-kml dependency into my POM. > >>> Thanks for any hint. > >>> Theodor > >>> > >>>> -----Original Message----- > >>>> From: Justin Deoliveira [mailto:[EMAIL PROTECTED] > >>>> Sent: Monday, May 05, 2008 8:32 PM > >>>> To: Theodor Foerster > >>>> Cc: GeoTools Devel List > >>>> Subject: Re: [Geotools-devel] KML Writer in Geotools > >>>> > >>>> Hi Theodor, > >>>> > >>>> Perhaps you are thinking about GeoServer. We have some > KML writing > >>>> stuff there.. but its not part of geotools, and its not > >> GTXML based. > >>>> However, i have been working on a parser in geotools, > and that is > >>>> what is there. > >>>> > >>>> I added basic support for writing over the weekend, i just > >> committed > >>>> it to geotools trunk. If you try it out now... you should get > >>>> something. > >>>> There are no styles hooked up yet though however. > >>>> > >>>> -Justin > >>>> > >>>> Theodor Foerster wrote: > >>>>> Hi Justin, > >>>>> Thanks for your answer. However, I am a bit confused, as I > >>>> read in one > >>>>> of the previous posts about KML, that some facilities for > >>>> writing KML > >>>>> would exist. Or did I understood that wrongly? Anyway, when > >>>> would you > >>>>> plan to put some time for it. We are thinking of migrating > >>>> to geotools > >>>>> 2.5 and could support you with testing. > >>>>> > >>>>> Thanks & best regards > >>>>> > >>>>> > >>>>>> -----Original Message----- > >>>>>> From: Justin Deoliveira [mailto:[EMAIL PROTECTED] > >>>>>> Sent: Friday, May 02, 2008 8:25 PM > >>>>>> To: Theodor Foerster > >>>>>> Cc: GeoTools Devel List > >>>>>> Subject: Re: [Geotools-devel] KML Writer in Geotools > >>>>>> > >>>>>> Hi Theodor, > >>>>>> > >>>>>> The kml stuff in geotools as of now only does parsing... > >>>> no encoding. > >>>>>> Adding encoding would be too much work... but a little. I > >>>> can try to > >>>>>> slot it into some volunteer time... should only take me a few > >>>>>> hours... > >>>>>> (famous last words :)) > >>>>>> > >>>>>> -Justin > >>>>>> > >>>>>> Theodor Foerster wrote: > >>>>>>> Hi, > >>>>>>> We are struggeling with KML support in GT 2.5. We got the > >>>>>> parsing of > >>>>>>> GML working and are now trying to write those GT features > >>>>>> back as KML > >>>>>>> (using the GTXML framework). Is there any possibility to > >>>>>> get it working? > >>>>>>> Please find attached our current experimental code. > >>>>>>> > >>>>>>> Thanks for your help > >>>>>>> > >>>>>>> Theodor > >>>>>>> > >>>>>>> BTW: Why does the Parser (configured with GMLConfiguration > >>>>>> and a WFS > >>>>>>> getFeature result as input) return a HashMap and not a > >>>>>>> FeatureCollection, as expected. > >>>>>>> > >>>>>>> SNIPPET: > >>>>>>> SimpleFeature sf = ... > >>>>>>> org.geotools.xml.Configuration kmlconfiguration = new > >>>>>>> org.geotools.kml.KMLConfiguration(); > >>>>>>> org.geotools.xml.Encoder encoder = new > >> org.geotools.xml.Encoder( > >>>>>>> kmlconfiguration ); encoder.encode(sf, KML.kml, System.out); > >>>>>>> > >>>>>>> ITC, Enschede > >>>>>>> Department of Geo Information Processing PO. Box 6 7500 AA > >>>>>> Enschede > >>>>>>> the Netherlands International Institute for > >>>> Geo-Information Science > >>>>>>> and Earth Observation (ITC) Chamber of Commerce: 410 27 560 > >>>>>>> > >>>>>>> E-mail disclaimer > >>>>>>> The information in this e-mail, including any attachments, > >>>>>> is intended for the addressee only. If you are not the > intended > >>>>>> recipient, you are hereby notified that any > disclosure, copying, > >>>>>> distribution or action in relation to the content of this > >>>> information > >>>>>> is strictly prohibited. If you have received this e-mail > >>>> by mistake, > >>>>>> please delete the message and any attachment and inform > >>>> the sender by > >>>>>> return e-mail. ITC accepts no liability for any error or > >>>> omission in > >>>>>> the message content or for damage of any kind that may > >> arise as a > >>>>>> result of e-mail transmission. > >> > --------------------------------------------------------------------- > >>>>>> - > >>>>>>> --- This SF.net email is sponsored by the 2008 JavaOne(SM) > >>>>>> Conference > >>>>>>> Don't miss this year's exciting event. There's still time > >>>>>> to save $100. > >>>>>>> Use priority code J8TL2D2. > >>>>>>> > >> > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.co > >>>>>> m > >>>>>>> /javaone _______________________________________________ > >>>>>>> Geotools-devel mailing list > >>>>>>> Geotools-devel@lists.sourceforge.net > >>>>>>> https://lists.sourceforge.net/lists/listinfo/geotools-devel > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>> -- > >>>>>> Justin Deoliveira > >>>>>> The Open Planning Project > >>>>>> [EMAIL PROTECTED] > >>>>>> > >>>>> International Institute for Geo-Information Science and Earth > >>>>> Observation (ITC) Chamber of Commerce: 410 27 560 > >>>>> > >>>>> E-mail disclaimer > >>>>> The information in this e-mail, including any attachments, > >>>> is intended for the addressee only. If you are not the intended > >>>> recipient, you are hereby notified that any disclosure, copying, > >>>> distribution or action in relation to the content of this > >> information > >>>> is strictly prohibited. If you have received this e-mail > >> by mistake, > >>>> please delete the message and any attachment and inform > >> the sender by > >>>> return e-mail. ITC accepts no liability for any error or > >> omission in > >>>> the message content or for damage of any kind that may > arise as a > >>>> result of e-mail transmission. > >>>>> > >>>> -- > >>>> Justin Deoliveira > >>>> The Open Planning Project > >>>> [EMAIL PROTECTED] > >>>> > >>> International Institute for Geo-Information Science and > >> Earth Observation (ITC) > >>> Chamber of Commerce: 410 27 560 > >>> > >>> E-mail disclaimer > >>> The information in this e-mail, including any attachments, > >> is intended for the addressee only. If you are not the intended > >> recipient, you are hereby notified that any disclosure, copying, > >> distribution or action in relation to the content of this > information > >> is strictly prohibited. If you have received this e-mail > by mistake, > >> please delete the message and any attachment and inform > the sender by > >> return e-mail. ITC accepts no liability for any error or > omission in > >> the message content or for damage of any kind that may arise as a > >> result of e-mail transmission. > >>> > >> -------------------------------------------------------------- > >> ----------- > >>> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > >>> Don't miss this year's exciting event. There's still time > >> to save $100. > >>> Use priority code J8TL2D2. > >>> > >> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java > > .sun.com/javaone > >>> _______________________________________________ > >>> Geotools-devel mailing list > >>> Geotools-devel@lists.sourceforge.net > >>> https://lists.sourceforge.net/lists/listinfo/geotools-devel > >>> > >>> > >>> > >> > >> -- > >> Justin Deoliveira > >> The Open Planning Project > >> [EMAIL PROTECTED] > >> > > International Institute for Geo-Information Science and Earth > > Observation (ITC) Chamber of Commerce: 410 27 560 > > > > E-mail disclaimer > > The information in this e-mail, including any attachments, > is intended for the addressee only. If you are not the > intended recipient, you are hereby notified that any > disclosure, copying, distribution or action in relation to > the content of this information is strictly prohibited. If > you have received this e-mail by mistake, please delete the > message and any attachment and inform the sender by return > e-mail. ITC accepts no liability for any error or omission in > the message content or for damage of any kind that may arise > as a result of e-mail transmission. > > > > > ---------------------------------------------------------------------- > > --- This SF.net email is sponsored by the 2008 JavaOne(SM) > Conference > > Don't miss this year's exciting event. There's still time > to save $100. > > Use priority code J8TL2D2. > > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com > > /javaone _______________________________________________ > > Geotools-devel mailing list > > Geotools-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/geotools-devel > > > > !DSPAM:4007,4822196762181431913854! > > > > > -- > Justin Deoliveira > The Open Planning Project > [EMAIL PROTECTED] > International Institute for Geo-Information Science and Earth Observation (ITC) Chamber of Commerce: 410 27 560 E-mail disclaimer The information in this e-mail, including any attachments, is intended for the addressee only. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or action in relation to the content of this information is strictly prohibited. If you have received this e-mail by mistake, please delete the message and any attachment and inform the sender by return e-mail. ITC accepts no liability for any error or omission in the message content or for damage of any kind that may arise as a result of e-mail transmission. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel