org.geotools.data.wfs.WFSDataStoreFactory.createDataStore()方法的使用及代码示例

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

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

WFSDataStoreFactory.createDataStore介绍

[英]Requests the WFS Capabilities document from the WFSDataStoreFactory#URL parameter in params and returns a WFSDataStore according to the version of the GetCapabilities document returned.

Note the URL provided as parameter must refer to the actual GetCapabilities request. If you need to specify a preferred version or want the GetCapabilities request to be generated from a base URL build the URL with the #createGetCapabilitiesRequest first.
[中]从params中的WFSDataStoreFactory#URL参数请求WFS Capabilities文档,并根据返回的GetCapabilities文档的版本返回WFSDataStore。
注意,作为参数提供的URL必须引用实际的GetCapabilities请求。如果需要指定首选版本或希望从基本URL生成GetCapabilities请求,请首先使用#createGetCapabilitiesRequest构建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: geoserver/geoserver

DataStore remoteStore = factory.createDataStore(params);
FeatureSource fs = remoteStore.getFeatureSource(TOPP_STATES);
remoteWFSStatesAvailable = Boolean.TRUE;

代码示例来源: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);
  }
}

代码示例来源: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-widgets-swing-pending

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

相关文章