Changes between Version 3 and Version 4 of DevWikiPostGISCoding


Ignore:
Timestamp:
12/09/10 08:54:03 (14 years ago)
Author:
pramsey
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • DevWikiPostGISCoding

    v3 v4  
    5555{
    5656       PG_LWGEOM *result;
     57       LWGEOM *theline;
     58
    5759       /* Detoast the actual PgSQL varlena structures, in our case PG_LWGEOM (soon to be GSERIALIZED) */
    5860       PG_LWGEOM *geom1 = (PG_LWGEOM*)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
    5961       PG_LWGEOM *geom2 = (PG_LWGEOM*)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
     62
    6063       /* Build LWGEOM from the varlena (soon to be with lwgeom_from_gserialized) */
    6164       LWGEOM *lwgeom1 = pglwgeom_deserialize(geom1);
    6265       LWGEOM *lwgeom2 = pglwgeom_deserialize(geom2);
    63        LWGEOM *theline;
    6466
    65 
     67       /* SRID consistency test */
    6668       if (lwgeom1->srid != lwgeom2->srid)
    6769       {
     
    7072       }
    7173
     74       /* Calculate the shortest line, returned as an LWGEOM */
    7275       theline = lw_dist2d_distanceline(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MIN);
    7376       if (lwgeom_is_empty(theline))
     
    7679       /* Serialize the result back down from LWGEOM, but don't return right away */
    7780       result = pglwgeom_serialize(theline);
     81
    7882       /* First free the LWGEOMs you used */
    7983       lwgeom_free(lwgeom1);