#include "liblwgeom_internal.h"
#include "cu_tester.h"
-static void do_geojson_test(const char * exp, char * in, char * exp_srs, int precision, int has_bbox)
+static void do_geojson_test(const char * exp, char * in, char * exp_srs)
{
LWGEOM *g;
char * h = NULL;
do_geojson_test(
"LINESTRING(0 1,2 3,4 5)",
"{\"type\":\"LineString\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[0,1],[2,3],[4,5]]}",
- "EPSG:4326", 0, 0);
+ "EPSG:4326");
/* Polygon */
do_geojson_test(
"POLYGON((0 1,2 3,4 5,0 1))",
"{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]]]}",
- "EPSG:4326", 0, 0);
+ "EPSG:4326");
/* Polygon - with internal ring */
do_geojson_test(
"POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
"{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]],[[6,7],[8,9],[10,11],[6,7]]]}",
- "EPSG:4326", 0, 0);
+ "EPSG:4326");
/* Multiline */
do_geojson_test(
"MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
"{\"type\":\"MultiLineString\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[0,1],[2,3],[4,5]],[[6,7],[8,9],[10,11]]]}",
- "EPSG:4326", 0, 0);
+ "EPSG:4326");
/* MultiPolygon */
do_geojson_test(
"MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
"{\"type\":\"MultiPolygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[[0,1],[2,3],[4,5],[0,1]]],[[[6,7],[8,9],[10,11],[6,7]]]]}",
- "EPSG:4326", 0, 0);
+ "EPSG:4326");
/* Empty GeometryCollection */
do_geojson_test(
"GEOMETRYCOLLECTION EMPTY",
"{\"type\":\"GeometryCollection\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"geometries\":[]}",
- "EPSG:4326", 0, 0);
+ "EPSG:4326");
}
static void in_geojson_test_bbox(void)
do_geojson_test(
"LINESTRING(0 1,2 3,4 5)",
"{\"type\":\"LineString\",\"bbox\":[0,1,4,5],\"coordinates\":[[0,1],[2,3],[4,5]]}",
- NULL, 0, 1);
+ NULL);
/* Polygon */
do_geojson_test(
"POLYGON((0 1,2 3,4 5,0 1))",
"{\"type\":\"Polygon\",\"bbox\":[0,1,4,5],\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]]]}",
- NULL, 0, 1);
+ NULL);
/* Polygon - with internal ring */
do_geojson_test(
"POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
"{\"type\":\"Polygon\",\"bbox\":[0,1,4,5],\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]],[[6,7],[8,9],[10,11],[6,7]]]}",
- NULL, 0, 1);
+ NULL);
/* Multiline */
do_geojson_test(
"MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
"{\"type\":\"MultiLineString\",\"bbox\":[0,1,10,11],\"coordinates\":[[[0,1],[2,3],[4,5]],[[6,7],[8,9],[10,11]]]}",
- NULL, 0, 1);
+ NULL);
/* MultiPolygon */
do_geojson_test(
"MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
"{\"type\":\"MultiPolygon\",\"bbox\":[0,1,10,11],\"coordinates\":[[[[0,1],[2,3],[4,5],[0,1]]],[[[6,7],[8,9],[10,11],[6,7]]]]}",
- NULL, 0, 1);
+ NULL);
/* GeometryCollection */
do_geojson_test(
"GEOMETRYCOLLECTION(LINESTRING(0 1,-1 3),LINESTRING(2 3,4 5))",
"{\"type\":\"GeometryCollection\",\"bbox\":[-1,1,4,5],\"geometries\":[{\"type\":\"LineString\",\"coordinates\":[[0,1],[-1,3]]},{\"type\":\"LineString\",\"coordinates\":[[2,3],[4,5]]}]}",
- NULL, 0, 1);
+ NULL);
/* Empty GeometryCollection */
do_geojson_test(
"GEOMETRYCOLLECTION EMPTY",
"{\"type\":\"GeometryCollection\",\"geometries\":[]}",
- NULL, 0, 1);
+ NULL);
}
static void in_geojson_test_geoms(void)
do_geojson_test(
"LINESTRING(0 1,2 3,4 5)",
"{\"type\":\"LineString\",\"coordinates\":[[0,1],[2,3],[4,5]]}",
- NULL, 0, 0);
+ NULL);
/* Polygon */
do_geojson_test(
"POLYGON((0 1,2 3,4 5,0 1))",
"{\"type\":\"Polygon\",\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]]]}",
- NULL, 0, 0);
+ NULL);
/* Polygon - with internal ring */
do_geojson_test(
"POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
"{\"type\":\"Polygon\",\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]],[[6,7],[8,9],[10,11],[6,7]]]}",
- NULL, 0, 0);
+ NULL);
/* Multiline */
do_geojson_test(
"MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
"{\"type\":\"MultiLineString\",\"coordinates\":[[[0,1],[2,3],[4,5]],[[6,7],[8,9],[10,11]]]}",
- NULL, 0, 0);
+ NULL);
/* MultiPolygon */
do_geojson_test(
"MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
"{\"type\":\"MultiPolygon\",\"coordinates\":[[[[0,1],[2,3],[4,5],[0,1]]],[[[6,7],[8,9],[10,11],[6,7]]]]}",
- NULL, 0, 0);
+ NULL);
/* MultiPolygon with internal rings */
/* See http://trac.osgeo.org/postgis/ticket/2216 */
do_geojson_test(
"MULTIPOLYGON(((4 0,0 -4,-4 0,0 4,4 0),(2 0,0 2,-2 0,0 -2,2 0)),((24 0,20 -4,16 0,20 4,24 0),(22 0,20 2,18 0,20 -2,22 0)),((44 0,40 -4,36 0,40 4,44 0),(42 0,40 2,38 0,40 -2,42 0)))",
"{'type':'MultiPolygon','coordinates':[[[[4,0],[0,-4],[-4,0],[0,4],[4,0]],[[2,0],[0,2],[-2,0],[0,-2],[2,0]]],[[[24,0],[20,-4],[16,0],[20,4],[24,0]],[[22,0],[20,2],[18,0],[20,-2],[22,0]]],[[[44,0],[40,-4],[36,0],[40,4],[44,0]],[[42,0],[40,2],[38,0],[40,-2],[42,0]]]]}",
- NULL, 0, 0);
+ NULL);
/* GeometryCollection */
do_geojson_test(
"GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
"{\"type\":\"GeometryCollection\",\"geometries\":[{\"type\":\"Point\",\"coordinates\":[0,1]},{\"type\":\"LineString\",\"coordinates\":[[2,3],[4,5]]}]}",
- NULL, 0, 0);
+ NULL);
/* Empty GeometryCollection */
do_geojson_test(
"GEOMETRYCOLLECTION EMPTY",
"{\"type\":\"GeometryCollection\",\"geometries\":[]}",
- NULL, 0, 0);
+ NULL);
}
/*
}
static int
-asx3d3_point_sb(const LWPOINT *point, char *srs, int precision, int opts, const char *defid, stringbuffer_t *sb)
+asx3d3_point_sb(const LWPOINT *point, __attribute__((__unused__)) char *srs, int precision,
+ int opts, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
{
/** for point we just output the coordinates **/
return ptarray_to_x3d3_sb(point->point, precision, opts, 0, sb);
/** Return the linestring as an X3D LineSet */
static int
-asx3d3_line_sb(const LWLINE *line, char *srs, int precision, int opts, const char *defid, stringbuffer_t *sb)
+asx3d3_line_sb(const LWLINE *line, __attribute__((__unused__)) char *srs, int precision,
+ int opts, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
{
/* int dimension=2; */
/** Compute the X3D coordinates of the polygon and add to string buffer **/
static int
-asx3d3_poly_sb(const LWPOLY *poly, char *srs, int precision, int opts, int is_patch, const char *defid, stringbuffer_t *sb)
+asx3d3_poly_sb(const LWPOLY *poly, __attribute__((__unused__)) char *srs, int precision,
+ int opts, __attribute__((__unused__)) int is_patch, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
{
uint32_t i;
for (i=0; i<poly->nrings; i++)
}
static int
-asx3d3_triangle_sb(const LWTRIANGLE *triangle, char *srs, int precision, int opts, const char *defid, stringbuffer_t *sb)
+asx3d3_triangle_sb(const LWTRIANGLE *triangle, __attribute__((__unused__)) char *srs, int precision,
+ int opts, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
{
return ptarray_to_x3d3_sb(triangle->points, precision, opts, 1, sb);
}
* Don't call this with single-geoms inspected!
*/
static int
-asx3d3_multi_sb(const LWCOLLECTION *col, char *srs, int precision, int opts, const char *defid, stringbuffer_t *sb)
+asx3d3_multi_sb(const LWCOLLECTION *col, __attribute__((__unused__)) char *srs, int precision, int opts, const char *defid, stringbuffer_t *sb)
{
char *x3dtype;
uint32_t i;
* Computes X3D representation of TIN (as IndexedTriangleSet and adds to string buffer)
*/
static int
-asx3d3_tin_sb(const LWTIN *tin, char *srs, int precision, int opts, const char *defid, stringbuffer_t *sb)
+asx3d3_tin_sb(const LWTIN *tin, __attribute__((__unused__)) char *srs, int precision, int opts, const char *defid, stringbuffer_t *sb)
{
uint32_t i;
uint32_t k;