org.geotools.data.wfs.WFSDataStoreFactory类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.geotools.data.wfs.WFSDataStoreFactory类的一些代码示例,展示了WFSDataStoreFactory类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WFSDataStoreFactory类的具体详情如下:
包路径:org.geotools.data.wfs.WFSDataStoreFactory
类名称:WFSDataStoreFactory

WFSDataStoreFactory介绍

[英]A DataStoreFactorySpi to connect to a Web Feature Service.

Produces a WFSDataStore if the correct set of connection parameters are provided. For instance, the only mandatory one is #URL.

As with all the DataStoreFactorySpi implementations, this one is not intended to be used directly but through the DataStoreFinder mechanism, hence client applications should not have strong dependencies over this module.

Upon a valid URL to a WFS GetCapabilities document, this factory will perform version negotiation between the server supported protocol versions and this plugin supported ones, and will return a DataStore capable of communicating with the server using the agreed WFS protocol version.

In the case the provided GetCapabilities URL explicitly contains a VERSION parameter and both the server and client support that version, that version will be used.
[中]连接到Web功能服务的DataStoreFactorySpi。
如果提供了正确的连接参数集,则生成WFSDataStore。例如,唯一必须的是#URL。
与所有DataStoreFactorySpi实现一样,这一个不打算直接使用,而是通过DataStoreFinder机制使用,因此客户端应用程序不应该对该模块有很强的依赖性。
在获得WFS GetCapabilities文档的有效URL后,此工厂将在服务器支持的协议版本和此插件支持的版本之间执行版本协商,并将返回一个能够使用商定的WFS协议版本与服务器通信的数据存储。
如果提供的GetCapabilities URL显式包含一个版本参数,并且服务器和客户端都支持该版本,则将使用该版本。

代码示例

代码示例来源:origin: geoserver/geoserver

/**
 * Constructs a {@link WFSDataStore} from an OWS URL.
 *
 * @param remoteOwsUrl
 * @return
 * @throws ServiceException if there was a problem accessing the remote service
 */
protected static DataStore connectRemoteWFS(URL remoteOwsUrl) {
  try {
    WFSDataStoreFactory storeFactory = new WFSDataStoreFactory();
    Map params = new HashMap(storeFactory.getImplementationHints());
    params.put(
        WFSDataStoreFactory.URL.key,
        remoteOwsUrl + "&request=GetCapabilities&service=WFS");
    params.put(WFSDataStoreFactory.TRY_GZIP.key, Boolean.TRUE);
    DataStore dataStore = storeFactory.createDataStore(params);
    return dataStore;
  } catch (Exception e) {
    throw new ServiceException("Could not connect to remote OWS", e, "RemoteOWSFailure");
  }
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

/**
 * Setup the WFS data source and add the DynamicStreetNotesSource to the graph
 */
@Override
public void setup(Graph graph) throws IOException, FactoryException {
  LOG.info("Setup WFS polling updater");
  HashMap<String, Object> connectionParameters = new HashMap<>();
  connectionParameters.put(WFSDataStoreFactory.URL.key, url);
  WFSDataStore data = (new WFSDataStoreFactory()).createDataStore(connectionParameters);
  query = new Query(featureType); // Read only single feature type from the source
  query.setCoordinateSystem(CRS.decode("EPSG:4326", true)); // Get coordinates in WGS-84
  featureSource = data.getFeatureSource(featureType);
  graph.streetNotesService.addNotesSource(notesSource);
}

代码示例来源:origin: org.geotools/gt-widgets-swing-pending

store = new WFSDataStoreFactory().createDataStore(params);
refreshTable();
gui_progress.setString(BUNDLE.getString("waiting"));

代码示例来源:origin: geotools/geotools

return createGetCapabilitiesRequest(host, requestVersion);

代码示例来源:origin: org.geotools/gt-wfs

http.setTimeoutMillis(timeoutMillis);
final byte[] wfsCapabilitiesRawData = loadCapabilities(getCapabilitiesRequest, http);
final Document capsDoc = parseCapabilities(wfsCapabilitiesRawData);
final Element rootElement = capsDoc.getDocumentElement();
  WFSStrategy strategy = determineCorrectStrategy(getCapabilitiesRequest, capsDoc, wfsStrategy );
  wfs.setStrategy(strategy);
  dataStore = new WFS_1_1_0_DataStore(wfs);

代码示例来源:origin: geotools/geotools

final HTTPClient http = getHttpClient(params);
http.setTryGzip(config.isTryGZIP());
http.setUser(config.getUser());

代码示例来源:origin: org.geotools/gt-widgets-swing-pending

@Override
      public void run() {
        try {

          params.put(WFSDataStoreFactory.URL.key, new URL(jtf_url.getText()));
          params.put(WFSDataStoreFactory.USERNAME.key, jtf_user.getText());
          params.put(WFSDataStoreFactory.PASSWORD.key, new String(jtf_password.getPassword()));
          params.put(WFSDataStoreFactory.BUFFER_SIZE.key, jsp_buff_size.getValue());
          params.put(WFSDataStoreFactory.ENCODING.key, jtf_encoding.getText());
          params.put(WFSDataStoreFactory.LENIENT.key, chk_lenient.isSelected());
          params.put(WFSDataStoreFactory.MAXFEATURES.key, jsp_max_features.getValue());
          params.put(WFSDataStoreFactory.PROTOCOL.key, chk_protocol.isSelected());
          params.put(WFSDataStoreFactory.TIMEOUT.key, jsp_timeout.getValue());
          params.put(WFSDataStoreFactory.TRY_GZIP.key, chk_gzip.isSelected());

//                    store = DataStoreFinder.getDataStore(params);
          store = new WFSDataStoreFactory().createDataStore(params);
          refreshTable();
          gui_progress.setString(BUNDLE.getString("waiting"));
        } catch (Exception ex) {
          store = null;
          gui_progress.setString(BUNDLE.getString("error"));
        }
      }
    };

代码示例来源:origin: org.geotools/gt-wfs

return createGetCapabilitiesRequest(host, requestVersion);

代码示例来源:origin: org.geotools/gt-wfs-ng

final HTTPClient http = getHttpClient(params);
http.setTryGzip(config.isTryGZIP());
http.setUser(config.getUser());

代码示例来源:origin: geoserver/geoserver

WFSDataStoreFactory factory = new WFSDataStoreFactory();
Map<String, Serializable> params =
    new HashMap(factory.getImplementationHints());
URL url =
    new URL(
DataStore remoteStore = factory.createDataStore(params);
FeatureSource fs = remoteStore.getFeatureSource(TOPP_STATES);
remoteWFSStatesAvailable = Boolean.TRUE;

代码示例来源:origin: org.geotools/gt-widgets-swing-pending

RandomStyleFactory rsf = new RandomStyleFactory();
WFSDataStoreFactory factory = new WFSDataStoreFactory();
try {
  store = factory.createDataStore(params);
  FeatureSource<SimpleFeatureType, SimpleFeature> fs = store.getFeatureSource(store.getTypeNames()[0]);
  Style style = rsf.createRandomVectorStyle(fs);

代码示例来源:origin: org.geotools/gt-wfs-ng

return createGetCapabilitiesRequest(host, requestVersion);

代码示例来源:origin: org.geoserver/gs-wms

private static DataStore connectRemoteWFS(URL remoteOwsUrl) throws ServiceException {
  try {
    WFSDataStoreFactory factory = new WFSDataStoreFactory();
    Map params = new HashMap(factory.getImplementationHints());
    params.put(
        WFSDataStoreFactory.URL.key,
        remoteOwsUrl + "&request=GetCapabilities&service=WFS");
    params.put(WFSDataStoreFactory.TRY_GZIP.key, Boolean.TRUE);
    return factory.createDataStore(params);
  } catch (Exception e) {
    throw new ServiceException("Could not connect to remote OWS", e, "RemoteOWSFailure");
  }
}

代码示例来源:origin: org.geoserver/wms

private static DataStore connectRemoteWFS(URL remoteOwsUrl) throws WmsException {
  try {
    WFSDataStoreFactory factory = new WFSDataStoreFactory();
    Map params = new HashMap(factory.getImplementationHints());
    params.put(WFSDataStoreFactory.URL.key, remoteOwsUrl + "request=GetCapabilities&service=WFS");
    params.put(WFSDataStoreFactory.TRY_GZIP.key, Boolean.TRUE);
    return factory.createDataStore(params);
  } catch(Exception e) {
    throw new WmsException("Could not connect to remote OWS", "RemoteOWSFailure",e);
  }
}

相关文章