|
From: Tobias S. <tob...@ca...> - 2014-03-21 16:21:43
|
Hello, I am trying to use the GeoTools WFS plugin for WFS servers, that do not have a namespace prefix for the name of the feature type. For example, the following WFS has two feature types "park" and "popplace": http://www2.dmsolutions.ca/cgi-bin/mswfs_gmap?version=1.1.0&request=getcapabilities&service=wfs String baseUrl = "http://www2.dmsolutions.ca/cgi-bin/mswfs_gmap?"; > URL url = WFSDataStoreFactory.createGetCapabilitiesRequest(new > URL(baseUrl), Version.v1_1_0); > > Map connectionParameters = new HashMap(); > > connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL", url); > > DataStore data = > DataStoreFinder.getDataStore(connectionParameters); > > String[] typeNames = data.getTypeNames(); > System.out.println(ArrayUtils.toString(typeNames)); > > FeatureType schema = data.getSchema("popplace"); > System.out.println("Schema Attributes:" + > schema.getDescriptors().size()); > This small test program outputs: Mar 21, 2014 4:32:05 PM org.geotools.data.wfs.WFSDataStoreFactory > determineCorrectStrategy > INFO: Using WFS Strategy: org.geotools.data.wfs.v1_1_0.DefaultWFSStrategy > Exception in thread "main" org.geotools.data.SchemaNotFoundException: > Feature type could not be found for popplace > at > org.geotools.data.wfs.v1_1_0.WFS_1_1_0_DataStore.getSchema(WFS_1_1_0_DataStore.java:260) > at fr.brgm.infoterre.web.join.WFSExample.main(WFSExample.java:30) > {wfs:park,wfs:popplace} If I request the schema for "wfs:popplace", I'll get the following exception: Mar 21, 2014 4:33:23 PM org.geotools.data.wfs.WFSDataStoreFactory > determineCorrectStrategy > INFO: Using WFS Strategy: org.geotools.data.wfs.v1_1_0.DefaultWFSStrategy > {wfs:park,wfs:popplace} > Exception in thread "main" org.geotools.data.DataSourceException: No > XSDElementDeclaration found for {http://www.opengis.net/wfs}popplace > at > org.geotools.data.wfs.v1_1_0.parsers.EmfAppSchemaParser.parseFeatureType(EmfAppSchemaParser.java:318) > at > org.geotools.data.wfs.v1_1_0.parsers.EmfAppSchemaParser.parse(EmfAppSchemaParser.java:222) > at > org.geotools.data.wfs.v1_1_0.parsers.EmfAppSchemaParser.parseSimpleFeatureType(EmfAppSchemaParser.java:131) > at > org.geotools.data.wfs.v1_1_0.WFS_1_1_0_Protocol.issueDescribeFeatureTypeGET(WFS_1_1_0_Protocol.java:798) > at > org.geotools.data.wfs.v1_1_0.WFS_1_1_0_DataStore.getSchema(WFS_1_1_0_DataStore.java:265) > at fr.brgm.infoterre.web.join.WFSExample.main(WFSExample.java:30) > If I use WFS version 1.0.0 it works, but I would need version 1.1.0. Is there a workaround to tell the WFS_1_1_0_DataStore not to use namespaces? Thanks! Tobias Sauerwein |