[Gdal-dev] Changes between 1.1.9 and 1.20
Clay, Bruce
bclay at ball.com
Fri May 7 16:15:34 EDT 2004
Frank:
When I used version 1.1.9 in my app I could read ArcView shape files
from the EP200 data set at http://www.cdc.gov/epiinfo/shape.htm.
When multiple polygons were used for a given country they were still
reported as type Polygon and everything was happy. With the update to
version 1.2.0 the same data set reports them as multi-polygons and for
some reason they down parse out the same. The code I used to use is:
vectorNodePtr->type = POLYGON;
status = OGRPolygonLabelPoint((OGRPolygon *)geom_handl,
&labelPoint);
if (status >= 0) // == OGRERR_NONE)
{
status = 0;
vectorNodePtr->labelPoint.xPos = labelPoint.getX();
vectorNodePtr->labelPoint.yPos = labelPoint.getY();
vectorNodePtr->labelPoint.zPos = labelPoint.getZ();
}
for( iRing = 0; iRing < geom_cnt; iRing++ )
{
ringPtr = new struct ringRec;
if (ringPtr != NULL)
{
vectorNodePtr->ringList.push_back(ringPtr);
OGRGeometryH ring_handl = OGR_G_GetGeometryRef(
geom_handl, iRing );
if (dump_fdes != NULL)
{
fprintf(dump_fdes, "Ring %d\n", iRing );
}
// allocate memory for the current ring
if (vectorNodePtr->numDimensions == 3)
{
ringPtr->threeDList = new std::vector
<struct threeDDataRec *>;
ringPtr->twoDList = NULL;
}
else
{
ringPtr->twoDList = new std::vector
<struct twoDDataRec *>;
ringPtr->threeDList = NULL;
}
for( iPoint = 0; iPoint <
OGR_G_GetPointCount(ring_handl); iPoint++ )
{
if (vectorNodePtr->numDimensions == 3)
{
threeDdataPtr = new struct
threeDDataRec;
ringPtr->threeDList->push_back(threeDdataPtr);
// set default values for color and line width
threeDdataPtr->colorIndex = 0;
threeDdataPtr->lineWidth = 1.0f;
threeDdataPtr->xPos =
OGR_G_GetX( ring_handl, iPoint);
threeDdataPtr->yPos =
OGR_G_GetY( ring_handl, iPoint);
threeDdataPtr->zPos =
OGR_G_GetZ( ring_handl, iPoint);
if (dump_fdes != NULL)
{
fprintf(dump_fdes, "
%d: (%g,%g,%g)\n", iPoint,
OGR_G_GetX( ring_handl, iPoint ),
OGR_G_GetY( ring_handl, iPoint ),
OGR_G_GetZ( ring_handl, iPoint ) );
}
}
else
{
twoDdataPtr = new struct
twoDDataRec;
ringPtr->twoDList->push_back(twoDdataPtr);
// set default values for color and line width
twoDdataPtr->colorIndex = 0;
twoDdataPtr->lineWidth = 1.0f;
twoDdataPtr->xPos = OGR_G_GetX(
ring_handl, iPoint);
twoDdataPtr->yPos = OGR_G_GetY(
ring_handl, iPoint);
if (dump_fdes != NULL)
{
fprintf(dump_fdes, "
%d: (%g,%g)\n", iPoint,
OGR_G_GetX( ring_handl, iPoint ),
OGR_G_GetY( ring_handl, iPoint ));
}
}
}
} // if ringPtr != NULL
} // end of for ring = 0 to geom_cnt
I notice that OGR_G_GetPointCount returns 0 with the multipolygon so I
tried changing GetPointCount to (OGRMultiPolygon
*)ring_handl)->getNumGeometries(). That only returns a count of 1.
That is the only get count type of call I saw when I searched for
MultiPolygon.
Do you see anything I am missing?
Thanks for your time and the library.
Bruce Clay
bclay at ball.com
More information about the Gdal-dev
mailing list