<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hello,<br>
<br>
Geotookit-pending has a wfs feature store.<br>
<dependency><br>
<groupId>org.geotoolkit.pending</groupId><br>
<artifactId>geotk-client-wfs</artifactId><br>
<version>${geotoolkit-pending.version}</version><br>
</dependency><br>
<br>
Since plenty of users complained about the geotools store model
over the year when we moved aways we adopted are more conventional
model.<br>
If you have a few troubles finding what you are looking for here
is a schema : <br>
<a class="moz-txt-link-freetext" href="http://hg.geotoolkit.org/geotoolkit-pending/rawfile/7ad96ae39cb181ebd2dae042f88b953f411f0495/src/site/resources/images/new_structure.png">http://hg.geotoolkit.org/geotoolkit-pending/rawfile/7ad96ae39cb181ebd2dae042f88b953f411f0495/src/site/resources/images/new_structure.png</a><br>
<br>
And here is the equivalent of your code :<br>
<br>
final ParameterValueGroup wfsParams =
WFSDataStoreFactory.PARAMETERS_DESCRIPTOR.createValue();<br>
Parameters.getOrCreate(AbstractServerFactory.URL,
wfsParams).setValue(new URL(<a class="moz-txt-link-rfc2396E" href="http://.....">"http://....."</a>));<br>
Parameters.getOrCreate(WFSDataStoreFactory.VERSION,
wfsParams).setValue("1.1.0"); <br>
final FeatureStore wfsStore =
FeatureStoreFinder.open(wfsParams);<br>
<br>
for(Name typeName : wfsStore.getNames()){<br>
final Filter filter =
CQL.parseFilter("attribute=something");<br>
final Query query = QueryBuilder.filtered(typeName,
filter);<br>
final Envelope env = wfsStore.getEnvelope(query);<br>
System.out.println(env);<br>
}<br>
<br>
>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?<br>
>Do you think would be good to copy as well to the geotools-dev
mailing list to get their feedback?<br>
<br>
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.<br>
But nevertheless you should raise the subject again on their list,
one day or another they will have to fix it.<br>
<br>
Johann Sorel<br>
Geomatys<br>
<br>
<br>
On 02/11/2012 13:07, Emmanuel Blondel wrote:<br>
</div>
<blockquote cite="mid:5093B76F.4090002@gmail.com" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">Yes, thanks for these precisions. <br>
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.<br>
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).<br>
<br>
Would you have some example with ClassLoader that i could try to
apply?<br>
I thank you very much in advance for that.<br>
<br>
The other alternative for me, maybe would be to get the bounding
box from WFS filtered layer, using Geotoolkit and not
Geotools/WFsDatastore.<br>
Would it be possible with Geotoolkit? In this case, it would
allow me do not depending anymore on gt-opengis.<br>
<br>
For information this is the method I used with Geotools:<br>
<br>
<i>/** Get Species Distribution BBOX</i><i><br>
</i><i> * </i><i><br>
</i><i> * @param alphacode</i><i><br>
</i><i> * @return</i><i><br>
</i><i> */</i><i><br>
</i><i> public static ReferencedEnvelope
getSpeciesBoundingBox(String alphacode){</i><i><br>
</i><i> </i><i><br>
</i><i> try{ </i><i><br>
</i><i> //WFS feature collection</i><i><br>
</i><i> Map<String, Serializable> params = new
HashMap<String, Serializable>();</i><i><br>
</i><i> params.put(WFSDataStoreFactory.URL.key,
"MyWFSGetCapabilities");</i><i><br>
</i><i> params.put(WFSDataStoreFactory.TIMEOUT.key,
new Integer(60000));</i><i><br>
</i><i> </i><i><br>
</i><i> datastore =
DataStoreFinder.getDataStore(params);</i><i><br>
</i><i> featureSource =
datastore.getFeatureSource("mylayer");</i><i><br>
</i><i> </i><i><br>
</i><i> String cql = "attribute='"+value+"'";</i><i><br>
</i><i> Filter filter = CQL.toFilter(cql);</i><i><br>
</i><i> Query query = new Query("mylayer",filter);</i><i><br>
</i><i> SimpleFeatureCollection sfc =
featureSource.getFeatures( query );</i><i><br>
</i><i> </i><i><br>
</i><i> </i><i><br>
</i><i> //bounds calculation</i><i><br>
</i><i> ReferencedEnvelope bounds = new
ReferencedEnvelope();</i><i><br>
</i><i> SimpleFeatureIterator iterator =
sfc.features();</i><i><br>
</i><i> try {</i><i><br>
</i><i> while( iterator.hasNext() ){</i><i><br>
</i><i> SimpleFeature feature =
(SimpleFeature) iterator.next();</i><i><br>
</i><i> bounds.include(feature.getBounds());</i><i><br>
</i><i> }</i><i><br>
</i><i> System.out.println( "Calculated Bounds:"+
bounds );</i><i><br>
</i><i> }</i><i><br>
</i><i> finally {</i><i><br>
</i><i> if(iterator!=null){</i><i><br>
</i><i> iterator.close();</i><i><br>
</i><i> }</i><i><br>
</i><i> </i><i><br>
</i><i> }</i><i><br>
</i><i> return bounds;</i><i><br>
</i><i> }catch(Exception e){</i><i><br>
</i><i> throw new RuntimeException("impossible to get
bbox");</i><i><br>
</i><i> } </i><i><br>
</i><i> </i><i><br>
</i><i> }</i><br>
<br>
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?<br>
Do you think would be good to copy as well to the geotools-dev
mailing list to get their feedback?<br>
<br>
Thanks again<br>
Emmanuel<br>
<br>
<br>
Le 02/11/2012 12:52, Martin Desruisseaux a écrit :<br>
</div>
<blockquote cite="mid:5093B415.3050009@geomatys.fr" type="cite">Le
02/11/12 18:36, Emmanuel Blondel a écrit : <br>
<blockquote type="cite"> Now i know where was the problem. <br>
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. <br>
</blockquote>
<br>
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. <br>
<br>
Martin <br>
<br>
_______________________________________________ <br>
Geotoolkit mailing list <br>
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:Geotoolkit@lists.osgeo.org">Geotoolkit@lists.osgeo.org</a>
<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://lists.osgeo.org/mailman/listinfo/geotoolkit">http://lists.osgeo.org/mailman/listinfo/geotoolkit</a>
<br>
</blockquote>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Geotoolkit mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Geotoolkit@lists.osgeo.org">Geotoolkit@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/geotoolkit">http://lists.osgeo.org/mailman/listinfo/geotoolkit</a>
</pre>
</blockquote>
<br>
</body>
</html>