[geotk] Problem with XML marshalling

johann sorel johann.sorel at geomatys.com
Fri Nov 2 06:39:59 PDT 2012


Hello,

Geotookit-pending has a wfs feature store.
         <dependency>
             <groupId>org.geotoolkit.pending</groupId>
             <artifactId>geotk-client-wfs</artifactId>
<version>${geotoolkit-pending.version}</version>
         </dependency>

Since plenty of users complained about the geotools store model over the 
year when we moved aways we adopted are more conventional model.
If you have a few troubles finding what you are looking for here is a 
schema :
http://hg.geotoolkit.org/geotoolkit-pending/rawfile/7ad96ae39cb181ebd2dae042f88b953f411f0495/src/site/resources/images/new_structure.png

And here is the equivalent of your code :

         final ParameterValueGroup wfsParams = 
WFSDataStoreFactory.PARAMETERS_DESCRIPTOR.createValue();
         Parameters.getOrCreate(AbstractServerFactory.URL, 
wfsParams).setValue(new URL("http://....."));
         Parameters.getOrCreate(WFSDataStoreFactory.VERSION, 
wfsParams).setValue("1.1.0");
         final FeatureStore wfsStore = FeatureStoreFinder.open(wfsParams);

         for(Name typeName : wfsStore.getNames()){
             final Filter filter = CQL.parseFilter("attribute=something");
             final Query query = QueryBuilder.filtered(typeName, filter);
             final Envelope env = wfsStore.getEnvelope(query);
             System.out.println(env);
         }

 >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?

They already know , others before you already raised the problem on the 
geotools mailing list. It doesn't look like they want to change it.
But nevertheless you should raise the subject again on their list, one 
day or another they will have to fix it.

Johann Sorel
Geomatys


On 02/11/2012 13:07, Emmanuel Blondel wrote:
> 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 
> alphacode){//
> ////
> //        try{ //
> //            //WFS feature collection//
> //            Map<String, Serializable> params = new HashMap<String, 
> Serializable>();//
> //            params.put(WFSDataStoreFactory.URL.key, 
> "MyWFSGetCapabilities");//
> //            params.put(WFSDataStoreFactory.TIMEOUT.key, new 
> Integer(60000));//
> ////
> //            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) 
> iterator.next();//
> //                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
> Emmanuel
>
>
> 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
>
>
>
> _______________________________________________
> 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/a8a7a589/attachment.html>


More information about the Geotoolkit mailing list