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

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

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

Query.getCoordinateSystem介绍

[英]Get the coordinate system to use as an override for features retrieved by this Query.
[中]获取要用作此查询检索的要素替代的坐标系。

代码示例

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

newQuery.setCoordinateSystemReproject(null);
if (newQuery.getCoordinateSystem() != null) {
  newQuery.setCoordinateSystem(null);

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

protected FeatureReader<SimpleFeatureType, SimpleFeature> applyReprojectionDecorator(
    FeatureReader<SimpleFeatureType, SimpleFeature> reader,
    Query query,
    GetFeatureRequest request) {
  FeatureReader<SimpleFeatureType, SimpleFeature> tmp = reader;
  if (query.getCoordinateSystem() != null
      && !query.getCoordinateSystem()
          .equals(reader.getFeatureType().getCoordinateReferenceSystem())) {
    if (request.getSrsName() != null) {
      try {
        reader =
            new ForceCoordinateSystemFeatureReader(
                reader, query.getCoordinateSystem());
      } catch (SchemaException e) {
        LOGGER.warning(e.toString());
        reader = tmp;
      }
    } else {
      try {
        reader = new ReprojectFeatureReader(reader, query.getCoordinateSystem());
      } catch (Exception e) {
        LOGGER.warning(e.toString());
        reader = tmp;
      }
    }
  }
  return reader;
}

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

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

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

/**
 * @return the WFS advertised bounds of the feature type if {@code Filter.INCLUDE ==
 *     query.getFilter()}, reprojected to the Query's crs, or {@code null} otherwise as it would
 *     be too expensive to calculate.
 * @see FeatureSource#getBounds(Query)
 * @see org.geotools.data.store.ContentFeatureSource#getBoundsInternal(org.geotools.data.Query)
 */
@Override
protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException {
  if (!Filter.INCLUDE.equals(query.getFilter())) {
    return null;
  }
  final QName remoteTypeName = getRemoteTypeName();
  final CoordinateReferenceSystem targetCrs;
  if (null == query.getCoordinateSystem()) {
    targetCrs = client.getDefaultCRS(remoteTypeName);
  } else {
    targetCrs = query.getCoordinateSystem();
  }
  ReferencedEnvelope bounds = client.getBounds(remoteTypeName, targetCrs);
  return bounds;
}

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

/**
 * Configure expected
 *
 * @param origional
 * @param query
 * @return
 */
public static SimpleFeatureType retype(SimpleFeatureType origional, Query query) {
  CoordinateReferenceSystem crs = null;
  if (query.getCoordinateSystem() != null) {
    crs = query.getCoordinateSystem();
  }
  if (query.getCoordinateSystemReproject() != null) {
    crs = query.getCoordinateSystemReproject();
  }
  return retype(origional, query.getPropertyNames(), crs);
}

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

protected String getSupportedSrsName(GetFeatureRequest request, Query query) {
  String epsgCode = GML2EncodingUtils.epsgCode(query.getCoordinateSystem());
  Set<String> supported =
      request.getStrategy().getSupportedCRSIdentifiers(request.getTypeName());
  for (String supportedSrs : supported) {
    if (supportedSrs.endsWith(":" + epsgCode)) {
      return supportedSrs;
    }
  }
  return null;
}

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

if (query.getCoordinateSystemReproject() != null) {
  cs = query.getCoordinateSystemReproject();
} else if (query.getCoordinateSystem() != null) {
  cs = query.getCoordinateSystem();

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

public SimpleFeatureType getQueryType(Query query) throws IOException {
  final String typeName = query.getTypeName();
  final String propertyNames[] = query.getPropertyNames();
  final FeatureTypeInfo typeInfo = typeInfoCache.getFeatureTypeInfo(typeName);
  final SimpleFeatureType completeSchema = typeInfo.getFeatureType();
  SimpleFeatureType featureType = completeSchema;
  if (!query.retrieveAllProperties() || query.getCoordinateSystem() != null) {
    try {
      featureType =
          DataUtilities.createSubType(
              featureType, propertyNames, query.getCoordinateSystem());
    } catch (SchemaException e) {
      LOGGER.log(Level.FINEST, e.getMessage(), e);
      throw new DataSourceException("Could not create Feature Type for query", e);
    }
  }
  return featureType;
}

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

/**
 * Hashcode based on all parameters other than the handle.
 *
 * @return hascode for this Query
 */
@Override
public int hashCode() {
  String[] n = getPropertyNames();
  return ((n == null) ? (-1) : ((n.length == 0) ? 0 : (n.length | n[0].hashCode())))
      | getMaxFeatures()
      | ((getFilter() == null) ? 0 : getFilter().hashCode())
      | ((getTypeName() == null) ? 0 : getTypeName().hashCode())
      | ((getVersion() == null) ? 0 : getVersion().hashCode())
      | ((getCoordinateSystem() == null) ? 0 : getCoordinateSystem().hashCode())
      | ((getCoordinateSystemReproject() == null)
          ? 0
          : getCoordinateSystemReproject().hashCode())
      | getStartIndex();
}

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

/**
 * Invert axis order in the given query filter, if needed.
 *
 * @param query
 */
private void invertAxisInFilterIfNeeded(Query query, SimpleFeatureType featureType) {
  CoordinateReferenceSystem crs = query.getCoordinateSystem();
  if (crs == null) {
    crs = featureType.getCoordinateReferenceSystem();
  }
  boolean invertXY = WFSConfig.invertAxisNeeded(client.getAxisOrderFilter(), crs);
  if (invertXY) {
    invertAxisInFilter(query);
  }
}

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

if (query.getCoordinateSystemReproject() != null) {
  cs = query.getCoordinateSystemReproject();
} else if (query.getCoordinateSystem() != null) {
  cs = query.getCoordinateSystem();
if (query.getCoordinateSystem() != null) {
  originalCRS = query.getCoordinateSystem();

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

if (query.getCoordinateSystemReproject() != null) {
  cs = query.getCoordinateSystemReproject();
} else if (query.getCoordinateSystem() != null) {
  cs = query.getCoordinateSystem();

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

? (other.getVersion() == null)
    : getVersion().equals(other.getVersion()))
&& ((getCoordinateSystem() == null)
    ? (other.getCoordinateSystem() == null)
    : getCoordinateSystem().equals(other.getCoordinateSystem()))
&& ((getCoordinateSystemReproject() == null)
    ? (other.getCoordinateSystemReproject() == null)

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

: getVersion().equals(other.getVersion()))
&& ((getCoordinateSystem() == null)
    ? (other.getCoordinateSystem() == null)
    : getCoordinateSystem().equals(other.getCoordinateSystem()))
&& ((getCoordinateSystemReproject() == null)
    ? (other.getCoordinateSystemReproject() == null)

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

: getVersion().equals(other.getVersion()))
&& ((getCoordinateSystem() == null)
    ? (other.getCoordinateSystem() == null)
    : getCoordinateSystem().equals(other.getCoordinateSystem()))
&& ((getCoordinateSystemReproject() == null)
    ? (other.getCoordinateSystemReproject() == null)

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

FeatureTypes.transform(
          this.featureType, query.getCoordinateSystemReproject());
} else if (query.getCoordinateSystem() != null) {
  this.featureType =
      FeatureTypes.transform(this.featureType, query.getCoordinateSystem());

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

/**
 * Copy contructor.
 *
 * @param query the query to copy
 */
public Query(Query query) {
  this(
      query.getTypeName(),
      query.getNamespace(),
      query.getFilter(),
      query.getMaxFeatures(),
      query.getProperties(),
      query.getHandle());
  this.sortBy = query.getSortBy();
  this.coordinateSystem = query.getCoordinateSystem();
  this.coordinateSystemReproject = query.getCoordinateSystemReproject();
  this.version = query.getVersion();
  this.hints = query.getHints();
  this.startIndex = query.getStartIndex();
  this.alias = query.getAlias();
  this.joins = new ArrayList();
  for (Join j : query.getJoins()) {
    this.joins.add(new Join(j));
  }
}

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

/**
   * Copy contructor, clones the state of a generic Query into a DefaultQuery
   *
   * @param query
   */
  public DefaultQuery(Query query) {
    this(
        query.getTypeName(),
        query.getNamespace(),
        query.getFilter(),
        query.getMaxFeatures(),
        query.getProperties(),
        query.getHandle());
    this.sortBy = query.getSortBy();
    this.coordinateSystem = query.getCoordinateSystem();
    this.coordinateSystemReproject = query.getCoordinateSystemReproject();
    this.version = query.getVersion();
    this.hints = query.getHints();
    this.startIndex = query.getStartIndex();
    this.alias = query.getAlias();
    this.joins = query.getJoins();
  }
}

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

相关文章