这里分为两部分。第一部分,我们看具体代码:
package org.geoserver.gs.wps;
//wps选择方法
@DescribeProcess(
title = "Amount of information",
description = "Computes the number of amount of information"
)
@Component
public class AmountOfInformationProcess implements VectorProcess{
private static final Logger LOGGER = Logging.getLogger(AmountOfInformationProcess.class);
@DescribeResult(name = "amount of information", description = "Bounding box of input features")
public ReferencedEnvelope execute(
@DescribeParameter(name = "features", description = "Input feature collection") FeatureCollection featureCollection) {
// DefaultFeatureCollection results = new DefaultFeatureCollection();
// FeatureType targetFeatureType = createTargetFeatureType(featureCollection.getSchema());
org.geotools.feature.FeatureIterator featureIterator = featureCollection.features();
try {
while (featureIterator.hasNext()) {
SimpleFeature f = (SimpleFeature) featureIterator.next();
//获取原始坡高
System.out.println(f.getAttribute("原始坡度"));
}
} finally {
((org.geotools.feature.FeatureIterator) featureIterator).close();
}
//返回原始坡高数据,这里暂时用getBounds()代替
return featureCollection.getBounds();
}
结果:
15.0
50.0
32.0
43.0
61.0
24.0
20.0
40.0
40.0
43.0
37.0
42.0
30.0
再看看输出结果
结果不是坡度信息,而是bounds信息。这个修改成自己坡度信息就好了。