【问题标题】:geoserver and openlayers select rectangle pixel valuesgeoserver 和 openlayers 选择矩形像素值
【发布时间】:2014-10-15 11:26:14
【问题描述】:

我正在运行一个带有 1 个栅格文件 (GeoTIFF) 作为图层的地理服务器 (2.5.x)。从我的应用程序中,我可以在单击时(通过 WMS)访问单个像素值,但我真正感兴趣的是获取一系列像素,然后对其进行一些处理。我想这样做的方法是创建一个以 MOD_CTRL 作为触发器的控件,然后在拖动结束时将所选范围传递给地理服务器,以便我可以返回像素值列表。

    OpenLayers.Util.extend(control, {
      draw: function () {
          this.drag = new OpenLayers.Handler.Box( control,
              {"done": this.notice},
              {keyMask: OpenLayers.Handler.MOD_CTRL});
          this.drag.activate();
      },

      notice: function (bounds) {
        leftBottom = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.left, bounds.bottom)); 
        rightTop = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.right, bounds.top));
        console.log(leftBottom, rightTop);
        return(true);
      }

我面临的问题是我似乎找不到将“范围”(leftBottom,rightTop)传递给地理服务器的方法 - 只有一个像素。 leftBottom 和 rightTop 工作正常,但如何取回像素值列表?

这个函数似乎可以调用,但我不确定要使用哪个服务或参数...

 function makeCall(bounds) {

   var url = sec.getFullRequestString({
                                          REQUEST: "GetFeature",
                                          SERVICE: "WFS", //should this be WPS?
                                          EXCEPTIONS: "application/vnd.ogc.se_xml",
                                          typeNames: 'mystore:mylayer',
                                          BBOX: bounds.toBBOX(),
                                          INFO_FORMAT: 'text/plain',
                                          QUERY_LAYERS: layerlist,
                                          FEATURE_COUNT: 50,
                                          WIDTH: map.size.w,
                                          HEIGHT: map.size.h,
                                          format: 'image/png',
                                        },
                                        "http://localhost:8080/geoserver/wfs");

    var request = OpenLayers.Request.GET({
      url: url,
      callback: extractFeatures
    });
  }

任何帮助将不胜感激。

【问题讨论】:

    标签: openlayers raster geoserver geotiff


    【解决方案1】:

    WMS 无法获取矩形范围的像素,需要使用 WCS,或者最终自定义 WPS 流程。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-01
      • 1970-01-01
      • 2017-12-18
      • 2015-06-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多