[geos-devel] Writing a wrapper around LibGEOS

Regina Obe lr at pcorp.us
Sat Jan 28 22:24:25 PST 2023


Graham,

 

At a glance looks good and I love the diagrams.

The doc doesn’t seem to mention how to use the API, more conceptual stuff. I assume that will come once your API is more fleshed out. Would be interesting to see the code. Probably easier to see major mistakes misunderstandings that way.

 

So which language are you creating this wrapper in?  I am assuming C since you mentioned in your document

 

“With these two constraints, there appeared to be nothing available that would offer the functionality I wanted in a pure C package. Or so I thought, until I discovered a feature of LibGEOS that I had overlooked in my original research. LibGEOS is written in C++, but - unlike many other C++ packages which are accessible from C only through complex interfacing methods (writing in C but compiling with a C++ compiler, or performing nasty name-mangling tricks at link time, or writing cross-calling interface procedures that can't access all the C++ procedures) - this package came with a plain C interface already built. It was accessible through a Unix header file and accompanying library that could be accessed from standard C with no C++ involvement at all other than building the initial library with the supplied make files, and for most target systems LibGEOS could in fact be installed with a simple 1-line command using the system's package manager.”

 

 

With that said, might be helpful to look at some other projects that use the C-API  like “PostGIS”, or maybe you have already (all the files in that folder with geos in the name are wrappers around GEOS api:

 

https://git.osgeo.org/gitea/postgis/postgis/src/branch/master/liblwgeom

 

and shapely comes to mind too

 

https://github.com/shapely/shapely/blob/main/src/geos.c

 

Sad yes GEOS doesn’t handle curves, and GIS people seem to not care.

We need CAD folks. :)

 

Funny you mention CNC machines, brought back some fond memories. In my high school we had a huge CNC machine

and it was my first reallish use of applying geometry lessons. The CNC machine was the only thing I liked about that Woodworking and Machine Shop class we were all required to take.

 

Hope that helps,

Regina

 

 

 

From: geos-devel [mailto:geos-devel-bounces at lists.osgeo.org] On Behalf Of Graham Toal
Sent: Saturday, January 28, 2023 6:41 PM
To: geos-devel at lists.osgeo.org
Subject: [geos-devel] Writing a wrapper around LibGEOS

 

I'm writing an interface library to wrap around LibGEOS which I hope will simplify its use a little in other domains besides GIS. (Mainly for myself but I'm documenting it in case it's useful to anyone else.)

 

Rather than look at the (currently somewhat fluid) API, I was hoping one or two people familiar with the GEOS package would have a quick look over the first (incomplete) draft of the document that I'm writing for it, and pass on any major criticisms if I have got anything seriously wrong so far.

 

     http://gtoal.com/src/polygon/Manual.html

 

I haven't documented the API yet as it's not finalised; I'm making changes as I document everything. The 'TO DO' section at the end is not part of the document - those are just notes to myself.

 

Follow up by email (gtoal at gtoal.com <mailto:gtoal at gtoal.com> ) or reply here, whichever you think is more appropriate.  Thanks,

 

Graham

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20230129/e1427919/attachment.htm>


More information about the geos-devel mailing list