OGR C#

Frank Warmerdam warmerdam at POBOX.COM
Mon Nov 7 08:25:00 EST 2005


On 11/7/05, Karlgren Anders <anasu at wmdata.com> wrote:
>
>
>
> Hi, I've been looking at the C# wrapper for OGR and everything works fine
> but some classes found in the documentation could not be found in the C#
> wrapper. F.I The GeometryFactory class and the Polygon class. The problem is
> that I can't create a Geometry from scratch. Am I doing something wrong or?

Anders,

This question really belongs on the gdal-dev mailing list.

The C# wrapper is based on the OGR C API and deliberately
does not export all the concrete geometry classes.  Instead you
are expected to use the C function OGR_G_CreateGeometry(),
passing in the type you want (wkbPoint, wkbLineString, wkbPolygon, etc).

So to make a polygon you would need to create the rings individually
with OGR_G_CreateGeometry(wkbLinearRing), and attach the points
with OGR_G_AddPoint().  Then create polygon and use the
OGR_G_AddGeometryDirectly() to attach the rings to the polygon.

There should be analygous C# methods.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-dev mailing list