在Geoserver里面实现对地图图层信息的提取。

这里分为两部分。第一部分,我们看具体代码:

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信息。这个修改成自己坡度信息就好了。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值