[postgis-devel] Is posible to use function lwgeom_to_geojson in another c fuctions

Paul Ramsey pramsey at cleverelephant.ca
Sat Jun 25 07:08:53 PDT 2016


Writing extensions that use other extensions w/o a compile-time dependency is a little tricky, but not impossible, and very gratifying from a cleanliness point of view. Here is an example from ogr-fdw of looking up function Oids by name

https://github.com/pramsey/pgsql-ogr-fdw/blob/7c5699a20371eb1230e28cd1d3be12c76ee0035c/ogr_fdw.c#L1229-L1263 <https://github.com/pramsey/pgsql-ogr-fdw/blob/7c5699a20371eb1230e28cd1d3be12c76ee0035c/ogr_fdw.c#L1229-L1263>

Also, to get the generic input/output functions for a type (which in the case of PostGIS can be used to generate/consume hexewkb or ewkb) you don’t even need to look up the function, as the in/out/send/recv functions are all part of the type definition.

https://github.com/pramsey/pgsql-ogr-fdw/blob/7c5699a20371eb1230e28cd1d3be12c76ee0035c/ogr_fdw.c#L1131-L1135 <https://github.com/pramsey/pgsql-ogr-fdw/blob/7c5699a20371eb1230e28cd1d3be12c76ee0035c/ogr_fdw.c#L1131-L1135>

ATB,

P

> I wrote my function using postgre libs only by make few changes in
> row_to_json functions (this is not agregate, only something like first
> step), but I`m not able to find oid for relevant function to
> geometry_out in this

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20160625/1b87c2b2/attachment.html>


More information about the postgis-devel mailing list