PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwgeom_to_kml2()

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

Definition at line 44 of file lwout_kml.c.

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

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: