特定の境界ボックス内にあるシェープファイルから地理的特徴を含めようとしています。BoundingBox オプション [ 1 ] を使用した Matlab の shaperead 関数に似た関数を見つけることができなかったので、レイヤーのラインストリングから無関係なポイントを削除しようとしていますが、これを行う方法がわかりません (あると予想されます)。 addPoint [ 2 ] の反対)。私がこれまでに持っているコードは次のとおりです。
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
}
何か案は?