Hi there,

I tried to query a WFS-getFeatureRequest to (a local and also a public)
geoserver. The connect was successful but the reading of features fails with
the following exception:
org.opengis.referencing.NoSuchAuthorityCodeException: No code "EPSG:26713"
from authority "EPSG" found for object of type "EngineeringCRS" accompanied
from a parsing exception.
I use:
- Java JDK 1.6.0_27
- Windows 7
- GeoTools 8.0-M2
- GeoServer 2.1.2
I did the following to avoid the exception:
1. Add 'srsName=EPSG:31467' to the request parameter
2. Add the coordinateReferenceSystem to the query with the following code:
       CRSAuthorityFactory epsgFactory =
ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", null);
       CoordinateReferenceSystem crSystem =
epsgFactory.createCoordinateReferenceSystem("31467");
       query.setCoordinateSystem(crSystem);
3. Use rather a FeatureIterator over a
WFSDataStore#getFeatureSource(typeName);
But nothing really helped.

I run into the same trouble when I request "public" GeoServers. I noticed
that the CRS from WFSDataStore  returns always null.
My first assumption was, there is something wrong with the
CoordinateReferenceSystem because its always null.
But further investigation reveals that the parsing process continues despite
the NoSuchAuthorityCodeException. The actual trouble occurs while build up
the elementIndex from the underlaying xsd and assigning QName to an
XSDElementDeclaration. There was no elementDeclaration found for the given
QName. elementDeclaration was null and the following parsing process failed.
Perhaps the application deals with the wrong xsd (iso19112.xsd)? The
according getRequest is added below (see public issue).
The latter mentioned issues are happened to a public server.

Below the exception and the code I used for the local test.* (***LOCAL
ISSUE***)*.
Next, the getRequests and exceptions for the public request.* (***PUBLIC
ISSUE***)*
Ciao,
and thanks in advance
mannie


*(***LOCAL ISSUE***).*
24.10.2011 16:26:23 org.geotools.xml.impl.AttributeEncodeExecutor visit
WARNUNG: results[ class java.lang.String ] is not of type class
net.opengis.wfs.ResultTypeType
24.10.2011 16:26:23 org.geotools.xml.impl.AttributeEncodeExecutor visit
WARNUNG: Binding: {http://www.opengis.net/ows}ServiceType does not declare a
target type
24.10.2011 16:26:23 org.geotools.xml.impl.AttributeEncodeExecutor visit
WARNUNG: Binding: {http://www.opengis.net/wfs}Base_TypeNameListType does not
declare a target type
24.10.2011 16:26:23 org.geotools.xml.impl.AttributeEncodeExecutor visit
WARNUNG: Binding: {http://www.opengis.net/wfs}TypeNameListType does not
declare a target type
ERROR [main] (WfsTest.java:51) - No code "EPSG:26713" from authority "EPSG"
found for object of type "EngineeringCRS".
org.geotools.data.DataSourceException: No code "EPSG:26713" from authority
"EPSG" found for object of type "EngineeringCRS".
    at
org.geotools.data.wfs.v1_1_0.parsers.XmlSimpleFeatureParser.parseAttributeValue(XmlSimpleFeatureParser.java:219)
    at
org.geotools.data.wfs.v1_1_0.parsers.XmlSimpleFeatureParser.parse(XmlSimpleFeatureParser.java:186)
    at
org.geotools.data.wfs.v1_1_0.WFSFeatureReader.<init>(WFSFeatureReader.java:52)
    at
org.geotools.data.wfs.v1_1_0.WFS_1_1_0_DataStore.getFeatureReader(WFS_1_1_0_DataStore.java:343)
    at com.tsa.geoserver.WfsTest.dataAccess(WfsTest.java:171)
    at com.tsa.geoserver.WfsTest.main(WfsTest.java:49)
Caused by: org.opengis.referencing.NoSuchAuthorityCodeException: No code
"EPSG:26713" from authority "EPSG" found for object of type
"EngineeringCRS".
    at
org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.noSuchAuthorityException(CartesianAuthorityFactory.java:136)
    at
org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.createEngineeringCRS(CartesianAuthorityFactory.java:130)
    at
org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.createCoordinateReferenceSystem(CartesianAuthorityFactory.java:121)
    at
org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:800)
    at
org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:800)
    at
org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:800)
    at
org.geotools.referencing.factory.ThreadedAuthorityFactory.createCoordinateReferenceSystem(ThreadedAuthorityFactory.java:731)
    at
org.geotools.referencing.DefaultAuthorityFactory.createCoordinateReferenceSystem(DefaultAuthorityFactory.java:179)
    at org.geotools.referencing.CRS.decode(CRS.java:489)
    at org.geotools.referencing.CRS.decode(CRS.java:417)
    at
org.geotools.data.wfs.v1_1_0.parsers.XmlSimpleFeatureParser.crs(XmlSimpleFeatureParser.java:613)
    at
org.geotools.data.wfs.v1_1_0.parsers.XmlSimpleFeatureParser.parseGeom(XmlSimpleFeatureParser.java:250)
    at
org.geotools.data.wfs.v1_1_0.parsers.XmlSimpleFeatureParser.parseAttributeValue(XmlSimpleFeatureParser.java:217)
    ... 5 more

*The code I use:*
public class WfsTest {

    protected static Logger logger = LoggerFactory.getLogger(WfsTest.class);

    public static void main(String[] args) {
        String url = "
http://localhost:8090/geoserver/wfs?service=WFS&request=GetCapabilities&version=1.1.0&srsName=EPSG:31467
";
        try {
            supressInfo();
            dataAccess(url);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            e.printStackTrace();

        }
    }

    public static void supressInfo() {
        org.geotools.util.logging.Logging.getLogger("org.geotools.gml")
                .setLevel(Level.ALL);
        org.geotools.util.logging.Logging.getLogger(
                "net.refractions.xml").setLevel(Level.ALL);
    }

    public static void dataAccess(String url) throws Exception {
       // Step 1 - connection parameters
       Map<String, Serializable> connectionParams = new HashMap<String,
Serializable>();
       connectionParams.put(WFSDataStoreFactory.URL.key, url);
       connectionParams.put(WFSDataStoreFactory.TIMEOUT.key, new
Integer(60000));
       connectionParams.put(WFSDataStoreFactory.MAXFEATURES.key, new
Integer(200000));
       connectionParams.put(WFSDataStoreFactory.WFS_STRATEGY.key,
"geoserver");
       connectionParams.put(WFSDataStoreFactory.PROTOCOL.key, Boolean.TRUE);

       // Step 2 - connection
       WFSDataStore wfs =
(WFSDataStore)DataStoreFinder.getDataStore(connectionParams);

       // Step 3 - discovery
       String typeNames[] = wfs.getTypeNames();
       String typeName = typeNames[0];

//       CoordinateReferenceSystem crs = wfs.getFeatureTypeCRS(typeName);
=> always returns null.

       SimpleFeatureType schema = wfs.getSchema(typeName);

       // Step 4 - target
       FeatureSource<SimpleFeatureType, SimpleFeature> source =
wfs.getFeatureSource(typeName);
       System.out.println("Metadata Bounds:" + source.getBounds());

       // Step 5 - query
       Query query = new Query(typeName);

       // FeatureCollection<SimpleFeatureType, SimpleFeature> features =
source.getFeatures(query);       => tried both, this and the next one.
       FeatureReader<SimpleFeatureType, SimpleFeature> ft =
wfs.getFeatureReader(query,Transaction.AUTO_COMMIT);  // => Trouble occurs
here!!

       int count = 0;
       while(ft.hasNext()) {
           if(ft.next()!=null)
               count++;

           SimpleFeature feature = ft.next();
           SimpleFeatureType type = feature.getFeatureType();
           Name featureName = feature.getName();
           logger.info("simpleFeatureType={}", type.getName());
           count++;
       }
       System.out.println("Found "+count+" features");
    }
}



* (***PUBLIC ISSUE***)
*GET
/gazetteer/dog-gaz-kas?TYPENAME=app%3AGemeinden&VERSION=1.1.0&SERVICE=WFS&REQUEST=DescribeFeatureType&NAMESPACE=xmlns%28app%3Dhttp%3A%2F%
2Fwww.deegree.org%2Fapp%29 HTTP/1.1
User-Agent: Java/1.6.0_23
Host: www.wms.nrw.de
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive*


*GET /schemas/iso19112.xsd HTTP/1.1
User-Agent: Java/1.6.0_23
Host: www.wms.nrw.de
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

The associated exception:
ERROR [main] (WfsBaseTest.java:85) - Error parsing feature type for {
http://www.deegree.org/app}Gemeinden from
http://www.wms.nrw.de/gazetteer/dog-gaz-kas?TYPENAME=app%3AGemeinden&VERSION=1.1.0&SERVICE=WFS&REQUEST=DescribeFeatureType&NAMESPACE=xmlns%28app%3Dhttp%3A%2F%2Fwww.deegree.org%2Fapp%29
java.io.IOException: Error parsing feature type for {
http://www.deegree.org/app}Gemeinden from
http://www.wms.nrw.de/gazetteer/dog-gaz-kas?TYPENAME=app%3AGemeinden&VERSION=1.1.0&SERVICE=WFS&REQUEST=DescribeFeatureType&NAMESPACE=xmlns%28app%3Dhttp%3A%2F%2Fwww.deegree.org%2Fapp%29
    at
org.geotools.data.wfs.v1_1_0.parsers.EmfAppSchemaParser.parse(EmfAppSchemaParser.java:266)
    at
org.geotools.data.wfs.v1_1_0.parsers.EmfAppSchemaParser.parseSimpleFeatureType(EmfAppSchemaParser.java:123)
    at
org.geotools.data.wfs.v1_1_0.parsers.EmfAppSchemaParser.parseSimpleFeatureType(EmfAppSchemaParser.java:92)
    at
org.geotools.data.wfs.v1_1_0.WFS_1_1_0_DataStore.getSchema(WFS_1_1_0_DataStore.java:214)
    at com.tsa.geoserver.WfsBaseTest.dataAccess(WfsBaseTest.java:149)
    at com.tsa.geoserver.WfsBaseTest.main(WfsBaseTest.java:83)
Caused by: java.lang.NullPointerException
    at
org.geotools.gml2.bindings.GML2ParsingUtils.featureType(GML2ParsingUtils.java:213)
    at
org.geotools.gml3.bindings.GML3ParsingUtils.featureType(GML3ParsingUtils.java:78)
    at
org.geotools.data.wfs.v1_1_0.parsers.EmfAppSchemaParser.parse(EmfAppSchemaParser.java:234)
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to