首页 文章

geoserver和openlayers选择矩形像素值

提问于
浏览
1

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

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
    });
  }

任何帮助将非常感激 .

1 回答

  • 0

    WMS无法获得矩形像素范围,您需要使用WCS,或最终使用自定义WPS进程 .

相关问题