本文整理了Java中org.geotools.data.Query.setTypeName
方法的一些代码示例,展示了Query.setTypeName
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setTypeName
方法的具体详情如下:
包路径:org.geotools.data.Query
类名称:Query
方法名:setTypeName
[英]Sets the name of the feature type to be queried. If no typename is specified, then the data source's default type will be used. When working with sources such as shapefiles that only support one feature type this method can be ignored.
[中]设置要查询的要素类型的名称。如果未指定typename,则将使用数据源的默认类型。在处理仅支持一种要素类型的源(如形状文件)时,可以忽略此方法。
代码示例来源:origin: geoserver/geoserver
public SimpleFeatureCollection getFeatures(Query query) throws IOException {
if (query.getTypeName() == null) {
query = new Query(query);
((Query) query).setTypeName(typeMap.getName());
} else if (!typeMap.getName().equals(query.getTypeName())) {
throw new IOException(
"Cannot query this feature source with "
+ query.getTypeName()
+ " since it serves only "
+ typeMap.getName());
}
// GEOS-3210, if the query specifies a subset of property names we need to take that into
// account
SimpleFeatureType target = typeMap.getFeatureType(query);
return new RetypingFeatureCollection(
wrapped.getFeatures(store.retypeQuery(query, typeMap)), target);
}
代码示例来源:origin: geoserver/geoserver
renamedQuery.setTypeName(coverageName);
SimpleFeatureCollection collection =
reader.getGranules(coverageName, readOnly).getGranules(renamedQuery);
代码示例来源:origin: geoserver/geoserver
modified.setTypeName(typeMap.getOriginalName());
modified.setFilter(retypeFilter(q.getFilter(), typeMap));
List<Join> joins = q.getJoins();
代码示例来源:origin: geotools/geotools
protected Query renameQuery(Query q) {
Query renamed = new Query(q);
renamed.setTypeName(delegateTypeName);
return renamed;
}
代码示例来源:origin: geotools/geotools
private Query namedQuery(final Query query) {
final String localName = typeInfo.getFeatureTypeName();
final String typeName = query.getTypeName();
if (typeName != null && !localName.equals(typeName)) {
throw new IllegalArgumentException(
"Wrong type name: " + typeName + " (this is " + localName + ")");
}
Query namedQuery = new Query(query);
namedQuery.setTypeName(localName);
return namedQuery;
}
代码示例来源:origin: geotools/geotools
private Query setupBaseQuery(Query q) {
if (q == null) {
q = new Query();
} else {
q = new Query(q);
}
if (hints != null) {
q.setHints(hints);
}
if (q.getTypeName() == null) {
q.setTypeName(typeName);
}
return q;
}
代码示例来源:origin: geotools/geotools
updatedQuery.setTypeName(coverageName);
代码示例来源:origin: geotools/geotools
/**
* Convert query to retrieve only id field, no other fields
*
* @return converted Query
*/
protected Query transformQueryToIdsOnly() {
Query idsQuery = new Query(unrollIndexes(query));
idsQuery.setProperties(getIndexQueryProperties());
idsQuery.setTypeName(mapping.getIndexSource().getSchema().getTypeName());
return idsQuery;
}
代码示例来源:origin: geotools/geotools
+ Arrays.toString(sb));
updatedQuery.setTypeName(typeName);
代码示例来源:origin: geotools/geotools
private Query namedQuery(Filter filter, int countLimit, boolean isJoining, Hints hints) {
Query query = isJoining ? new JoiningQuery() : new Query();
if (getName().getNamespaceURI() != null) {
try {
query.setNamespace(new URI(getName().getNamespaceURI()));
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
query.setTypeName(getName().getLocalPart());
query.setFilter(filter);
query.setMaxFeatures(countLimit);
query.setHints(hints);
return query;
}
代码示例来源:origin: geotools/geotools
protected Query getProxyObject(Query query, SimpleFeatureSource fs) {
String baseGeomPropertyName = info.getGeomPropertyName(); // generalized geom property
String backendGeomPropertyName = getBackendGeometryName(fs);
String[] originalPropNames = query.getPropertyNames();
String[] newPropNames;
if (originalPropNames == Query.ALL_NAMES) {
newPropNames = new String[getSchema().getAttributeCount()];
for (int i = 0; i < newPropNames.length; i++) {
AttributeDescriptor attrDescr = getSchema().getAttributeDescriptors().get(i);
newPropNames[i] =
attrDescr.getLocalName().equals(baseGeomPropertyName)
? backendGeomPropertyName
: attrDescr.getLocalName();
}
} else {
newPropNames = new String[originalPropNames.length];
for (int i = 0; i < newPropNames.length; i++) {
newPropNames[i] =
originalPropNames[i].equals(baseGeomPropertyName)
? backendGeomPropertyName
: originalPropNames[i];
}
}
Query newQuery = new Query(query);
newQuery.setTypeName(fs.getName().getLocalPart());
newQuery.setPropertyNames(newPropNames);
return newQuery;
}
代码示例来源:origin: geotools/geotools
@Override
public SimpleFeatureCollection getGranules(Query q) throws IOException {
// TODO: optimize this. It's currently "putting" all the features. No iterator is used.
// Filtering by typeName
if (q == null) {
q = new Query(typeName);
} else {
q.setTypeName(typeName);
}
Filter filter = q.getFilter();
q.setFilter(filter);
List<CoverageSlice> granules = innerCatalog.getGranules(q);
SimpleFeatureCollection collection =
new ListFeatureCollection(innerCatalog.getSchema(typeName));
for (CoverageSlice granule : granules) {
((ListFeatureCollection) collection).add(granule.getOriginator());
}
return collection;
}
代码示例来源:origin: geotools/geotools
/**
* Build the query for execute on index source partial Implementation manages pagination by
* itself, so remove bounds from query
*
* @return Query
*/
@Override
protected Query transformQueryToIdsOnly() {
Query idsQuery = new Query(unrollIndexes(partialIQM.getIndexQuery()));
idsQuery.setProperties(getIndexQueryProperties());
idsQuery.setTypeName(mapping.getIndexSource().getSchema().getTypeName());
idsQuery.setStartIndex(null);
idsQuery.setMaxFeatures(Integer.MAX_VALUE);
return idsQuery;
}
代码示例来源:origin: geotools/geotools
query.setTypeName(request.name);
代码示例来源:origin: geotools/geotools
/** Test of getTypeName method, of class org.geotools.data.Query. */
public void testTypeName() {
Query query = new Query();
assertNull(query.getTypeName());
query.setTypeName("foobar");
assertEquals("foobar", query.getTypeName());
query = new Query("mytype", Filter.EXCLUDE);
assertEquals("mytype", query.getTypeName());
}
代码示例来源:origin: geotools/geotools
newQuery.setTypeName(name);
newQuery.setFilter(unrolledFilter);
newQuery.setProperties(propNames);
代码示例来源:origin: org.geotools/gt-arcsde
private Query namedQuery(final Query query) {
final String localName = typeInfo.getFeatureTypeName();
final String typeName = query.getTypeName();
if (typeName != null && !localName.equals(typeName)) {
throw new IllegalArgumentException("Wrong type name: " + typeName + " (this is "
+ localName + ")");
}
Query namedQuery = new Query(query);
namedQuery.setTypeName(localName);
return namedQuery;
}
代码示例来源:origin: org.geotools/gt-wfs
private Query namedQuery(final String typeName, final Query query) {
if (query.getTypeName() != null && !query.getTypeName().equals(typeName)) {
throw new IllegalArgumentException("Wrong query type name: " + query.getTypeName()
+ ". It should be " + typeName);
}
Query named = new Query(query);
named.setTypeName(typeName);
return named;
}
代码示例来源:origin: geotools/geotools
Filter txFilter = transformFilter(query.getFilter());
Query txQuery = new Query(query);
txQuery.setTypeName(source.getSchema().getTypeName());
txQuery.setPropertyNames(getRequiredAttributes(query));
txQuery.setSortBy(getTransformedSortBy(query));
代码示例来源:origin: org.geotools/gt-wfs
protected FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader(String typeName,
Query query) throws IOException {
if ((query.getTypeName() == null) || !query.getTypeName().equals(typeName)) {
Query q = new Query(query);
((Query) q).setTypeName(typeName);
return getFeatureReader(q, Transaction.AUTO_COMMIT);
}
return getFeatureReader(query, Transaction.AUTO_COMMIT);
}
内容来源于网络,如有侵权,请联系作者删除!