주어진 경계 상자 내에있는 모양 파일의 지형지 물을 포함하려고합니다. BoundingBox 옵션 [1]이있는 Matlab의 shaperead 함수와 비슷한 함수를 찾을 수 없으므로 레이어의 선 스트링에서 관련이없는 점을 제거하려고하지만이 작업을 수행하는 방법이 확실하지 않습니다. addPoint [2]의 반대쪽). 지금까지 가지고있는 코드는 다음과 같습니다.GDAL에서 포인트 제거 LineString
OGRLineString *poLineString = (OGRLineString *) poGeometry;
int numPoints = poLineString->getNumPoints();
cout << "num points" << poLineString->getNumPoints() << endl;
//for each feature check if its in the bounding box
for (int i=0; i<numPoints; i++)
{
// start off assuming we are including everything
bool xInclude, yInclude = 1;
OGRPoint* poPoint;
poLineString->getPoint(i, poPoint);
double ptX = poPoint->getX();
double ptY = poPoint->getY();
cout << "ptX " << ptX << " ptY " << ptY <<endl;
//tlE, tlN, maxE, maxN are eastings/northings coordinates
if((ptX<tlE)||(ptX>maxE))
xInclude=0;
if((ptY<minN)||(ptY>tlN))
yInclude=0;
if(!(xInclude && yInclude))
//poLineString->setPoint(i,0,0);
REMOVE POINT HERE
}
아이디어가 있습니까?