OGR C#

Karlgren Anders anasu at WMDATA.COM
Fri Nov 11 05:43:11 EST 2005


Ok now the problem is howto convert the OGRGeometryH returned by
OGR_G_CreateGeometry(wkbLinearRing) to a C# OGR.Geometry class? Or do
you mean that I should work with the C API all the way and skip the C#
wrapper?

/Anders 

-----Original Message-----
From: UMN MapServer Developers List [mailto:MAPSERVER-DEV at LISTS.UMN.EDU]
On Behalf Of Frank Warmerdam
Sent: den 7 november 2005 14:25
To: MAPSERVER-DEV at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-DEV] OGR C#

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