116 projPJ input_pj, output_pj;
117 char *input_proj4, *output_proj4;
118 text *input_proj4_text;
119 text *output_proj4_text;
123 result_srid = PG_GETARG_INT32(3);
124 geom = PG_GETARG_GSERIALIZED_P_COPY(0);
130 input_proj4_text = (PG_GETARG_TEXT_P(1));
131 output_proj4_text = (PG_GETARG_TEXT_P(2));
139 if ( input_pj == NULL )
141 pj_errstr = pj_strerrno(*pj_get_errno_ref());
142 if ( ! pj_errstr ) pj_errstr =
"";
150 "transform_geom: could not parse proj4 string '%s' %s",
151 input_proj4, pj_errstr);
158 if ( output_pj == NULL )
160 pj_errstr = pj_strerrno(*pj_get_errno_ref());
161 if ( ! pj_errstr ) pj_errstr =
"";
169 "transform_geom: couldn't parse proj4 output string: '%s': %s",
170 output_proj4, pj_errstr);
178 lwgeom->
srid = result_srid;
193 PG_FREE_IF_COPY(geom, 0);
195 PG_RETURN_POINTER(result);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
projPJ lwproj_from_string(const char *txt)
Get a projection from a string representation.
void lwgeom_free(LWGEOM *geom)
int lwgeom_transform(LWGEOM *geom, projPJ inpj, projPJ outpj)
Transform (reproject) a geometry in-place.
char * text_to_cstring(const text *textptr)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)