我正在尝试开发(使用 C++ - MSVS 12.0)一个函数,该函数发现哪些像素(来自光栅图像)的中心位于多边形内(之前使用 shapefile 填充)。我正在使用从源代码构建并使用选项 INCLUDE_OGR_FRMTS=YES 的 GDAL 1.11.0(刚刚安装,使用 devinstall)。我可以毫无问题地使用 GDAL 和大多数 OGR 功能。但是,当我使用以下代码时:
if (polygon->Contains(tmpPoint))
我收到错误消息:错误 6:未启用 GEOS 支持
有人知道如何解决这个问题吗?
我在用着:
#include "ogrsf_frmts.h"
我的函数被声明:
void FindPixels(GDALDataset *image, OGRLayer *poLayer, OGRPolygon *polygon)
我的部分代码是:
OGRPoint *tmpPoint = NULL
OGRSpatialReference *spatialReference = NULL;
spatialReference = polygon->getSpatialReference();
tmpPoint = new OGRPoint();
tmpPoint->assignSpatialReference(spatialReference);
循环开始:
tmpPoint->setX(imgTLX + (j * imgRes) + imgResHalf);
tmpPoint->setY(imgTLY - (i * imgRes) - imgResHalf);
if (polygon->Contains(tmpPoint))
提前致谢!
MB