org.geotools.data.Query.setCoordinateSystem()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(223)

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

Query.setCoordinateSystem介绍

[英]Provide an override coordinate system to apply to features retrieved by this Query.

This denotes a request to temporarily override the coordinate system contained in the feature data source being queried. The same coordinate values will be used, but the features retrieved will appear in this Coordinate System.

This change is not persistent and only applies to the features returned by this Query. If used in conjunction with #getCoordinateSystemReproject() the reprojection will occur from #getCoordinateSystem() to #getCoordinateSystemReproject().
[中]提供替代坐标系以应用于此查询检索的要素。
这表示请求临时替代所查询要素数据源中包含的坐标系。将使用相同的坐标值,但检索到的特征将显示在此坐标系中。
此更改不是持久性的,仅适用于此查询返回的功能。如果与#getCoordinateSystemReproject()一起使用,则重新投影将从#getCoordinateSystem()到#getCoordinateSystemReproject()。

代码示例

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

newQuery.setCoordinateSystem(null);

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

query.setCoordinateSystem(sourceCRS);
query.setCoordinateSystemReproject(WGS84);
SimpleFeatureCollection featureCollection = featureSource.getFeatures(query);

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

Query getDefinitionQuery(
    Layer currLayer,
    FeatureSource<FeatureType, Feature> source,
    CoordinateReferenceSystem featCrs)
    throws FactoryException {
  // now, if a definition query has been established for this layer, be
  // sure to respect it by combining it with the bounding box one.
  Query definitionQuery = new Query(reprojectQuery(currLayer.getQuery(), source));
  definitionQuery.setCoordinateSystem(featCrs);
  return definitionQuery;
}

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

query.setCoordinateSystem(sourceCRS);
query.setCoordinateSystemReproject(WGS84);
SimpleFeatureCollection featureCollection = featureSource.getFeatures(query);

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

public void testSetsEnvelopeCrsFromQuery() throws Exception {
  Query query = new Query(Query.ALL);
  query.setCoordinateSystem(DefaultEngineeringCRS.CARTESIAN_2D);
  CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4326");
  SimpleFeatureSource river = data.getFeatureSource("river");
  SimpleFeatureCollection features = river.getFeatures(query);
  SimpleFeatureCollection expectedFeatures = DataUtilities.collection(riverFeatures);
  testTransformedFeatures(
      expectedFeatures, features, sourceCRS, DefaultEngineeringCRS.CARTESIAN_2D, null);
}

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

query.setCoordinateSystem(sourceCRS);
query.setCoordinateSystemReproject(worldCRS);

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

public void testSetsEnvelopeCrsFromQuery() throws Exception {
  Query query = new Query(Query.ALL);
  query.setCoordinateSystem(DefaultEngineeringCRS.CARTESIAN_2D);
  ReferencedEnvelope envelope = data.getFeatureSource("river").getBounds(query);
  assertEquals(DefaultEngineeringCRS.CARTESIAN_2D, envelope.getCoordinateReferenceSystem());
  assertEquals(
      new ReferencedEnvelope(riverBounds, DefaultEngineeringCRS.CARTESIAN_2D), envelope);
}

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

result.setCoordinateSystem(userQuery.getCoordinateSystem());
result.setCoordinateSystemReproject(userQuery.getCoordinateSystemReproject());
result.setStartIndex(userQuery.getStartIndex());

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

Query getDefinitionQuery(MapLayer currLayer, FeatureSource<FeatureType, Feature> source, CoordinateReferenceSystem featCrs) throws FactoryException {
  // now, if a definition query has been established for this layer, be
  // sure to respect it by combining it with the bounding box one.
  Query definitionQuery = reprojectQuery(currLayer.getQuery(), source);
  definitionQuery.setCoordinateSystem(featCrs);
  
  return definitionQuery;
}

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

public void testSetReprojectFeaturesCrsFromQuery() throws Exception {
  Query query = new Query(Query.ALL);
  query.setCoordinateSystem(DefaultEngineeringCRS.GENERIC_2D);
  query.setCoordinateSystemReproject(DefaultEngineeringCRS.CARTESIAN_2D);
  CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4326");
  SimpleFeatureSource river = data.getFeatureSource("river");
  SimpleFeatureCollection features = river.getFeatures(query);
  SimpleFeatureCollection expectedFeatures = DataUtilities.collection(riverFeatures);
  testTransformedFeatures(
      expectedFeatures,
      features,
      sourceCRS,
      DefaultEngineeringCRS.GENERIC_2D,
      DefaultEngineeringCRS.CARTESIAN_2D);
}

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

public void testSetReprojectEnvelopeCrsFromQuery() throws Exception {
  Query query = new Query(Query.ALL);
  query.setCoordinateSystem(DefaultEngineeringCRS.GENERIC_2D);
  query.setCoordinateSystemReproject(DefaultEngineeringCRS.CARTESIAN_2D);
  ReferencedEnvelope envelope = data.getFeatureSource("river").getBounds(query);
  assertEquals(DefaultEngineeringCRS.CARTESIAN_2D, envelope.getCoordinateReferenceSystem());
  assertEquals(
      new ReferencedEnvelope(riverBounds, DefaultEngineeringCRS.GENERIC_2D)
          .transform(DefaultEngineeringCRS.CARTESIAN_2D, true),
      envelope);
}

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

private Query namedQuery(Query query) {
  Query namedQuery =
      namedQuery(
          query.getFilter(), query.getMaxFeatures(), query instanceof JoiningQuery);
  namedQuery.setProperties(query.getProperties());
  namedQuery.setCoordinateSystem(query.getCoordinateSystem());
  namedQuery.setCoordinateSystemReproject(query.getCoordinateSystemReproject());
  namedQuery.setHandle(query.getHandle());
  namedQuery.setMaxFeatures(query.getMaxFeatures());
  namedQuery.setStartIndex(query.getStartIndex());
  namedQuery.setSortBy(query.getSortBy());
  namedQuery.setHints(query.getHints());
  if (query instanceof JoiningQuery) {
    ((JoiningQuery) namedQuery).setQueryJoins(((JoiningQuery) query).getQueryJoins());
    ((JoiningQuery) namedQuery).setRootMapping(((JoiningQuery) query).getRootMapping());
  }
  return namedQuery;
}

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

newQuery.setFilter(unrolledFilter);
newQuery.setProperties(propNames);
newQuery.setCoordinateSystem(query.getCoordinateSystem());
newQuery.setCoordinateSystemReproject(query.getCoordinateSystemReproject());
newQuery.setHandle(query.getHandle());

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

private Query namedQuery(Query query) {
  Query namedQuery = namedQuery(query.getFilter(), query.getMaxFeatures(), query instanceof JoiningQuery);        
  namedQuery.setProperties(query.getProperties());
  namedQuery.setCoordinateSystem(query.getCoordinateSystem());
  namedQuery.setCoordinateSystemReproject(query.getCoordinateSystemReproject());
  namedQuery.setHandle(query.getHandle());
  namedQuery.setMaxFeatures(query.getMaxFeatures());
  namedQuery.setSortBy(query.getSortBy());
  namedQuery.setHints(query.getHints());
  if (query instanceof JoiningQuery) {
    ((JoiningQuery) namedQuery).setQueryJoins(((JoiningQuery) query).getQueryJoins());
  }
  return namedQuery;
}

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

newQuery.setFilter(unrolledFilter);
newQuery.setProperties(propNames);
newQuery.setCoordinateSystem(query.getCoordinateSystem());
newQuery.setCoordinateSystemReproject(query.getCoordinateSystemReproject());
newQuery.setHandle(query.getHandle());

相关文章