PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwgeom_to_kml2()

char* lwgeom_to_kml2 ( const LWGEOM geom,
int  precision,
const char *  prefix 
)

Definition at line 43 of file lwout_kml.c.

44 {
45  stringbuffer_t *sb;
46  int rv;
47  char *kml;
48 
49  /* Can't do anything with empty */
50  if( lwgeom_is_empty(geom) )
51  return NULL;
52 
53  sb = stringbuffer_create();
54  rv = lwgeom_to_kml2_sb(geom, precision, prefix, sb);
55 
56  if ( rv == LW_FAILURE )
57  {
59  return NULL;
60  }
61 
64 
65  return kml;
66 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define LW_FAILURE
Definition: liblwgeom.h:79
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwgeom.c:1393
static int lwgeom_to_kml2_sb(const LWGEOM *geom, int precision, const char *prefix, stringbuffer_t *sb)
Definition: lwout_kml.c:69
stringbuffer_t * stringbuffer_create(void)
Allocate a new stringbuffer_t.
Definition: stringbuffer.c:35
void stringbuffer_destroy(stringbuffer_t *s)
Free the stringbuffer_t and all memory managed within it.
Definition: stringbuffer.c:78
char * stringbuffer_getstringcopy(stringbuffer_t *s)
Returns a newly allocated string large enough to contain the current state of the string.
Definition: stringbuffer.c:160

References LW_FAILURE, lwgeom_is_empty(), lwgeom_to_kml2_sb(), precision, stringbuffer_create(), stringbuffer_destroy(), and stringbuffer_getstringcopy().

Referenced by do_kml_test(), do_kml_test_prefix(), do_kml_unsupported(), geography_as_kml(), and LWGEOM_asKML().

Here is the call graph for this function:
Here is the caller graph for this function: