[geotk] Problem with XML marshalling

Emmanuel Blondel emmanuel.blondel1 at gmail.com
Fri Nov 2 05:07:11 PDT 2012

Yes, thanks for these precisions.
Actually I have an issue, because in my procedure, I also use some 
geotools plugin, i.e. the WFSDatastore, in order to get the bounding box 
of a piece of feature collection from WFS, for which I've built a 
separated method.
This module depends on gt-opengis. Consequently I cannot run my full 
java routine, either I cannot generate the metadata (if the dependency 
gt-opengis is enabled), either i can generate the metadata but I cannot 
use my custom bbox (if gt-opengis is disabled).

Would you have some example with ClassLoader that i could try to apply?
I thank you very much in advance for that.

The other alternative for me, maybe would be to get the bounding box 
from WFS filtered layer, using Geotoolkit and not Geotools/WFsDatastore.
Would it be possible with Geotoolkit? In this case, it would allow me do 
not depending anymore on gt-opengis.

For information this is the method I used with Geotools:

//** Get Species Distribution BBOX//
//     * //
//     * @param alphacode//
//     * @return//
//     *///
//    public static ReferencedEnvelope getSpeciesBoundingBox(String 
//        try{ //
//            //WFS feature collection//
//            Map<String, Serializable> params = new HashMap<String, 
//            params.put(WFSDataStoreFactory.URL.key, 
//            params.put(WFSDataStoreFactory.TIMEOUT.key, new 
//            datastore = DataStoreFinder.getDataStore(params);//
//            featureSource = datastore.getFeatureSource("mylayer");//
//            String cql = "attribute='"+value+"'";//
//            Filter filter = CQL.toFilter(cql);//
//            Query query = new Query("mylayer",filter);//
//            SimpleFeatureCollection sfc = featureSource.getFeatures( 
query );//
//            //bounds calculation//
//            ReferencedEnvelope bounds = new ReferencedEnvelope();//
//            SimpleFeatureIterator iterator = sfc.features();//
//            try {//
//                while( iterator.hasNext() ){//
//                    SimpleFeature feature = (SimpleFeature) 
//                bounds.include(feature.getBounds());//
//            }//
//                System.out.println( "Calculated Bounds:"+ bounds );//
//            }//
//            finally {//
//                if(iterator!=null){//
//                    iterator.close();//
//                }//
//            }//
//            return bounds;//
//        }catch(Exception e){//
//            throw new RuntimeException("impossible to get bbox");//
//        } //
//    }/

Otherwise, do you know what is the status of what you precised below 
regarding Geotools? Do you know if Geotools developers intend to change 
this, or not?
Do you think would be good to copy as well to the geotools-dev mailing 
list to get their feedback?

Thanks again

Le 02/11/2012 12:52, Martin Desruisseaux a écrit :
> Le 02/11/12 18:36, Emmanuel Blondel a écrit :
>>  Now i know where was the problem.
>> The fact is that i'm also using GeoTools. And t seems there was a 
>> conflict with the gt-opengis library...To test, i've excluded this 
>> dependency, and it works fine.
> Yes, this is a known problem... GeoTools should change the package 
> name of their interfaces, since they do not own the "org.opengis" 
> namespace and do not participate to the OGC working group. It may be 
> possible to allow the two libraries to co-exist with some tricky 
> ClassLoader use, but I'm not sure if it would really work.
>     Martin
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geotoolkit

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20121102/83842cb9/attachment.html>

More information about the Geotoolkit mailing list