1

I am new to GI systems. I am trying to retrieve features from a WFS using geotools:

this is my snippet :

String url = "http://geodaten.metropoleruhr.de/poi/poi?request=GetFeature&service=wfs&version=1.1.0";
Map<String, Object> connectionParameters = new HashMap<String, Object>();
connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL", url );

//connection
DataStore data = DataStoreFinder.getDataStore(connectionParameters);

but I get NullPointerException. Do I miss something ?

2
  • Strictly should be service=WFS&
    – nmtoken
    Jun 11, 2019 at 11:13
  • If you use that URL and then add a request=GetCapabilities you'll have a URL like http://geodaten.metropoleruhr.de/poi/poi?request=GetFeature&service=wfs&version=1.1.0&request=GetCapabilities which fails because the first request parameter is honoured. That is GeoTools is expecting a Capabilities response, but you are giving an incomplete GetFeature request and get an error response
    – nmtoken
    Jul 2, 2019 at 16:51

1 Answer 1

1

GeoTools is expecting a base URL so you need something like:

String url = "http://geodaten.metropoleruhr.de/poi/poi?service=wfs&version=1.1.0";

or even just:

String url = "http://geodaten.metropoleruhr.de/poi/poi?";

Also from my quick test you will need to add

connectionParameters.put(WFSDataStoreFactory.WFS_STRATEGY.key, "mapserver");

to work around some issues the server has with the standard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.