lwpoint_summary(LWPOINT *point, int offset)
{
char *result;
- result = lwalloc(128+offset);
char pad[offset+1];
+
memset(pad, ' ', offset);
pad[offset] = '\0';
+ result = lwalloc(128+offset);
+
sprintf(result, "%s%s[%s]\n",
pad, lwgeom_typename(TYPE_GETTYPE(point->type)),
lwgeom_typeflags(point->type));
lwline_summary(LWLINE *line, int offset)
{
char *result;
- result = lwalloc(128+offset);
char pad[offset+1];
+
memset(pad, ' ', offset);
pad[offset] = '\0';
+ result = lwalloc(128+offset);
+
sprintf(result, "%s%s[%s] with %d points\n",
pad, lwgeom_typename(TYPE_GETTYPE(line->type)),
lwgeom_typeflags(line->type),
PG_LWGEOM *result = NULL;
// read user-requested SRID if any
+#if USE_VERSION < 73
+ if ( fcinfo->nargs > 1 )
+#else
if ( PG_NARGS() > 1 )
+#endif
{
SRID = PG_GETARG_INT32(1);
if ( SRID != lwgeom_getSRID(geom) )
char *lwgeom;
char *result_cstring;
int len;
+ char *result,*loc_wkt;
+ char *semicolonLoc;
init_pg_func();
lwgeom = (char *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
result_cstring = unparse_WKT(lwgeom,lwalloc,lwfree);
- char *result,*loc_wkt;
- char *semicolonLoc;
-
semicolonLoc = strchr(result_cstring,';');
//loc points to start of wkt
{
POINT3DZ frm;
POINT3DZ to;
+ double distellips;
+
getPoint3dz_p(pts, i, &frm);
getPoint3dz_p(pts, i+1, &to);
- double distellips = distance_ellipse(
+ distellips = distance_ellipse(
frm.y*M_PI/180.0, frm.x*M_PI/180.0,
to.y*M_PI/180.0, to.x*M_PI/180.0, sphere);
dist += sqrt(distellips*distellips + (frm.z*frm.z));