Yea, the CRS doesn't need to be set in this case. Just wanted to make sure the right CRS is selected. :-)
I already confirmed the return value in the bug report: https://jira.codehaus.org/browse/GEOT-4889 The result is the DefaultGeographicCRS. Which I guess is expected in this case.
The code was just a test case to read out data with the new wfs-ng module. You are right for this issue it is not realy necessary.
I thought the recommended way to read out Data from a WFS is using a featureSource. As I understand the getSchema() call only returns the FeatureType (description of the FeatureType) and not the data itself. If there is a more perfomant way to get the data please enlighten me. :-)
Greetings
Jonas
Gesendet: Donnerstag, 04. September 2014 um 17:03 Uhr
Von: "Jody Garnett" <jody.garn...@gmail.com>
An: list-...@web.de
Cc: "geotools geotools-gt2-users@lists. sourceforge. net" <geotools-gt2-users@lists.sourceforge.net>
Betreff: Re: [Geotools-gt2-users] Question | reading out a FeatureCollection from an WFS
Von: "Jody Garnett" <jody.garn...@gmail.com>
An: list-...@web.de
Cc: "geotools geotools-gt2-users@lists. sourceforge. net" <geotools-gt2-users@lists.sourceforge.net>
Betreff: Re: [Geotools-gt2-users] Question | reading out a FeatureCollection from an WFS
Understood: Just because the it is a reference implementation does not prevent us from incorrect configuration :)
Can I ask why you set the CRS in your query?
Query query = new Query();
query.setCoordinateSystem(wfsDataStore.getFeatureSource(featureTypeName).getInfo().getCRS());
query.setMaxFeatures(5);
query.setCoordinateSystem(wfsDataStore.getFeatureSource(featureTypeName).getInfo().getCRS());
query.setMaxFeatures(5);
And can you confirm that wfsDataStore.getFeatureSource(featureTypeName).getInfo().getCRS() has a result?
A featureSource is a fairly heavy data structure to create and throw away .. I usually use dataStore.getSchema( name )
Jody Garnett
On Thu, Sep 4, 2014 at 2:12 AM, <list-...@web.de> wrote:
This is not the WFS I'm actually trying to use (not public). But I encountered the same Issue.I used this WFS for demonstation because of it's description "This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction."Gesendet: Mittwoch, 03. September 2014 um 22:04 Uhr
Von: "Jody Garnett" <jody.garn...@gmail.com>
An: list-...@web.de
Cc: "geotools geotools-gt2-users@lists. sourceforge. net" <geotools-gt2-users@lists.sourceforge.net>
Betreff: Re: [Geotools-gt2-users] Question | reading out a FeatureCollection from an WFSInteresting, well if the old wfs module is working the same way - then it may be something odd about the configuration of the WFS service you are trying to reach?In any case I will gather up your email and report the issue: https://jira.codehaus.org/browse/GEOT-4889Jody GarnettOn Tue, Sep 2, 2014 at 7:29 AM, <list-...@web.de> wrote:Thats the thing. I wasn't sure if it is a bug. The same behavior appears in the old version of the wfs modul.Maybe somebody could just execute the code and see if the CRS is in the created FeatureCollection.I can create the Bug report without problem. It's just a question if it is me beeing dumm or somthing real. :-)JonasGesendet: Dienstag, 02. September 2014 um 15:48 Uhr
Von: "Jody Garnett" <jody.garn...@gmail.com>
An: list-...@web.de
Cc: "geotools geotools-gt2-users@lists. sourceforge. net" <geotools-gt2-users@lists.sourceforge.net>
Betreff: Re: [Geotools-gt2-users] Question | reading out a FeatureCollection from an WFSCool - if you are testing with wfs-ng on 12-RC1 then we want a bug report as quick as we can :)Jody GarnettOn Tue, Sep 2, 2014 at 6:23 AM, <list-...@web.de> wrote:Maybe I described it wrong.I did use the new wfs-ng module from the Geotools 12-RC1 version. It behaves the same way as the old wfs module.JonasGesendet: Freitag, 29. August 2014 um 18:42 Uhr
Von: "Jody Garnett" <jody.garn...@gmail.com>
An: list-...@web.de
Cc: "geotools geotools-gt2-users@lists. sourceforge. net" <geotools-gt2-users@lists.sourceforge.net>
Betreff: Re: [Geotools-gt2-users] Question | reading out a FeatureCollection from an WFSCan you please try with GeoTools 12-RC1 - we wrote a new WFS client that needs testing, and since it is a replacement any trouble you are having with the old client won't be fixed.--JodyJody GarnettOn Fri, Aug 29, 2014 at 6:50 AM, <list-...@web.de> wrote:Hello,
I'm reading out Features from a WFS (using Windows 7 x64, Java 7, GeoTools 12-RC1 [gt-wfs, gt-epsg-hsql and other modules]).
The FeatureCollection I create doesn't have a CRS. Why is that?
And what do the last four warnings mean? Can I do anything to prevent them?
When I use the new gt-wfs-ng module or use the older GeoTools 11.1 the warnings stay the same.
Here is my code:
_____________________________________________________
String getCapabilities = "http://suite.opengeo.org/geoserver/wfs?service=wfs&version=1.1.0&request=GetCapabilities";
Map<String, String> connectionParameters = new HashMap<>();
connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL", getCapabilities );
DataStore dataStore = DataStoreFinder.getDataStore(connectionParameters);
WFSDataStore wfsDataStore = (WFSDataStore) dataStore;
String featureTypeName = "medford:hydro";
Query query = new Query();
query.setCoordinateSystem(wfsDataStore.getFeatureSource(featureTypeName).getInfo().getCRS());
query.setMaxFeatures(5);
SimpleFeatureCollection simpleFeatureCollection = wfsDataStore.getFeatureSource(featureTypeName).getFeatures(query);
int i = 0;
try (SimpleFeatureIterator iterator = simpleFeatureCollection.features()){
while(iterator.hasNext() ){
SimpleFeature feature = iterator.next();
System.out.println("Feature " + i + ": " + feature);
i++;
}
}
_____________________________________________________
I get following Warnings in the console:
_____________________________________________________
2014-08-29T15:31:31.298+0200 WARNING Creating location with null CoordinateReferenceSystem - did you mean to setCRS?
2014-08-29T15:31:31.308+0200 WARNING Creating the_geom with null CoordinateReferenceSystem - did you mean to setCRS?
2014-08-29T15:31:31.587+0200 WARNING results[ class java.lang.String ] is not of type class net.opengis.wfs.ResultTypeType
2014-08-29T15:31:31.597+0200 WARNING Binding: {http://www.opengis.net/ows}ServiceType does not declare a target type
2014-08-29T15:31:31.607+0200 WARNING Binding: {http://www.opengis.net/wfs}Base_TypeNameListType does not declare a target type
2014-08-29T15:31:31.607+0200 WARNING Binding: {http://www.opengis.net/wfs}TypeNameListType does not declare a target type
_____________________________________________________
Would be realy thankfull, if anybody could answer my questions.
With kind regards
Jonas
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users