[postgis-devel] Creating a POINTARRAY, what's the best way?

Paul Ramsey pramsey at opengeo.org
Thu May 26 13:28:39 PDT 2011


2011/5/26 Jorge Arévalo <jorge.arevalo at deimos-space.com>:
> Looking at liblwgeom code, I've found 2 ways of creating a POINTARRAY
> object from a list of points:
> - ptarray_construct/ptarray_insert_point/ptarray_append_point
> - wkt_parser_ptarray_new/wkt_parser_ptarray_add_coord

The wkt_ forms are meant for use by the wkt parser, so don't use them.
You'll note they aren't defined in liblwgeom.h. In a Glorious Future,
only public API calls will be there, and internal ones will be in

> Apart from this, I see "POINT" objects defined in 3 ways:
> - POINT(flags, x, y, z, m) in lwin_wkt.h
> - LWPOINT(type, flags, bbox, srid, point) in liblwgeom.h.
> The difference between the two last types of points is clear (a
> "light-weight point" stores more info than simply coords), but what's
> the difference between "POINT" and "POINT4D". They're equal. What
> should I use?

For now, use POINT4D. The idea of POINT is to have a POINT that is
generic and contains information about the expected dimensionality.
But we seem to have gotten by for the most part with POINT4D in the
past, and the generic POINT is not used anywhere at this point (and
might never be).


More information about the postgis-devel mailing list