118 projPJ input_pj, output_pj;
119 char *input_proj4, *output_proj4;
120 text *input_proj4_text;
121 text *output_proj4_text;
125 result_srid = PG_GETARG_INT32(3);
126 geom = PG_GETARG_GSERIALIZED_P_COPY(0);
132 input_proj4_text = (PG_GETARG_TEXT_P(1));
133 output_proj4_text = (PG_GETARG_TEXT_P(2));
141 if ( input_pj == NULL )
143 pj_errstr = pj_strerrno(*pj_get_errno_ref());
144 if ( ! pj_errstr ) pj_errstr =
"";
152 "transform_geom: could not parse proj4 string '%s' %s",
153 input_proj4, pj_errstr);
160 if ( output_pj == NULL )
162 pj_errstr = pj_strerrno(*pj_get_errno_ref());
163 if ( ! pj_errstr ) pj_errstr =
"";
171 "transform_geom: couldn't parse proj4 output string: '%s': %s",
172 output_proj4, pj_errstr);
180 lwgeom->
srid = result_srid;
196 PG_FREE_IF_COPY(geom, 0);
198 PG_RETURN_POINTER(result);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
int lwgeom_transform(LWGEOM *geom, projPJ inpj, projPJ outpj)
Transform (reproject) a geometry in-place.
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
projPJ lwproj_from_string(const char *txt)
Get a projection from a string representation.
char * text2cstring(const text *textptr)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.