From: | Paul Ramsey <pramsey(at)cleverelephant(dot)ca> |
---|---|
To: | Fabiana Zioti <fabi_zioti(at)hotmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Development of an extension for PostgreSQL and PostGIS |
Date: | 2017-08-14 18:36:03 |
Message-ID: | CACowWR2HiifS2X_Ue3L1L-+5dxewDgNAwkp96Uy+0w6UDymMdA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In order to get an LWGEOM from PostGIS you'll need to convert from the
serialized form (GSERIALIZED) which you can read all about in the
liblwgeom.h header. You'll be adding a hard dependency of course, but
hopefully you're OK with that.
If you're just hoping to build a compound type, as your example shows, you
can do that without a C extension, just read up on CREATE TYPE.
For an alternate example of an extension with a lighter dependency on
PostGIS, check out pgpointcloud, which has it's own structure for spatial
data (a point patch) and exchanges data with PostGIS via well-known-binary.
This removes the liblwgeom dependency, which means it's possible to compile
and use pgpointcloud without PostGIS installed, which is not entirely
uncommon.
P
On Mon, Aug 14, 2017 at 11:18 AM, Fabiana Zioti <fabi_zioti(at)hotmail(dot)com>
wrote:
> Hello.
>
> I will start developing an extension to PostgreSQL next to PostGIS using
> the C language.
>
> If my new type were:
>
>
> CREATE TYPE mytype (.., .., .., geom geometry);
>
> The creation of the structure in c, would be something like?
>
> #include "liblwgeom.h"
>
> Struct mytype
> {
> Int32 id;
> LWGEOM lwgeom;
>
> };
>
>
> In the extension I will create new data types for PostgreSQL, but I would
> like to use the geometric objects that the PostGIS extension offers, such
> as POINT, LINE, POLYGON, etc. In addition to their input functions (wkt-
> ST_GeomFromText ()), operators, index, etc.
>
> In this case just importing the liblwgeom library would be enough to
> develop an extension to PostgreSQL / PostGIS?
>
> Would you have any examples of such a project?
>
> Thanks in advance!!
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | stimits | 2017-08-14 18:46:13 | Queries for Diagramming Schema Keys |
Previous Message | Fabiana Zioti | 2017-08-14 18:18:39 | Development of an extension for PostgreSQL and PostGIS |