Changes between Version 8 and Version 9 of DevWikiPostGISCoding


Ignore:
Timestamp:
Dec 10, 2010, 5:01:18 PM (14 years ago)
Author:
pramsey
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • DevWikiPostGISCoding

    v8 v9  
    6363== LWGEOM vs PG_LWGEOM vs GSERIALIZED ==
    6464
    65 PG_LWGEOM and GSERIALIZED are both PostgreSQL varlena types. They have 4 bytes of metadata about size, then a payload. The payload of the PG_LWGEOM is descrived in the ./postgis/SERIALIZED_FORM document, and the payload in the GSERIALIZED is described in ./liblwgeom/gserialized.txt.  Basically they are serializations of a geometry, similar to well-know-binary.
     65PG_LWGEOM and GSERIALIZED are both PostgreSQL varlena types. They have 4 bytes of metadata about size, then a payload. The payload of the PG_LWGEOM is described in the ./postgis/SERIALIZED_FORM document, and the payload in the GSERIALIZED is described in ./liblwgeom/gserialized.txt.  Basically they are serializations of a geometry, similar to well-known binary (WKB).
    6666
    6767LWGEOM is a struct, with much more internal structure than the varlena byte strings. It has a type number, some flags, it has coordinates that are represented by a pointer(s) to POINTARRAY structs, or if it is a collection type it has sub-geometries represented by more pointers to LWGEOM structs. The ./liblwgeom directory is a library for working with LWGEOM structs.
     
    7171You can get LWGEOM from GSERIALIZED using lwgeom_from_gserialized() and you can get a GSERIALIZED from an LWGEOM using gserialized_from_lwgeom().
    7272
    73 Once you have instantiated an LWGEOM, you should remember to free it with lwgeom_free(). In the case where you want to free the LWGEOM struct and bounding box, but but leave the sub-geometries or POINTARRAYs intact, use lwgeom_release().
     73Once you have instantiated an LWGEOM, you should remember to free it with lwgeom_free(). In the case where you want to free the LWGEOM struct and bounding box, but leave the sub-geometries or POINTARRAYs intact, use lwgeom_release().
    7474
    7575