Dear all,

I am using OGR 1.7.3 to create polygons in C++.

The polygons end up as "Polygon ZM" instead of "Polygon".

The problem seems to be that adding a 2D OGRPoint to a 2D OGRLinearRing results in a 3D OGRLinearRing.

Can somebody explain?

Thanks, Alex

//test.cpp
#include <ogr_geometry.h>
#include <iostream>

int main()
{
OGRLinearRing* ring = ( OGRLinearRing* ) OGRGeometryFactory::createGeometry( wkbLinearRing ); OGRPoint* point = ( OGRPoint* ) OGRGeometryFactory::createGeometry( wkbPoint );
    point->setX( 1.0 );
    point->setY( 1.0 );

std::cout << "Point before: " << point->getCoordinateDimension() << "D" << std::endl; std::cout << "Ring before: " << ring->getCoordinateDimension() << "D" << std::endl;

    ring->addPoint(point);

std::cout << "Ring after: " << ring->getCoordinateDimension() << "D" << std::endl;

    return 1;
}

Output:
Point before: 2D
Ring before: 2D
Ring after: 3D

--
Alex Hagen-Zanker

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to