PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches
cu_out_encoded_polyline.c
Go to the documentation of this file.
1/**********************************************************************
2 *
3 * PostGIS - Spatial Types for PostgreSQL
4 * http://postgis.net
5 *
6 * Copyright 2014 Kashif Rasul <kashif.rasul@gmail.com> and
7 * Shoaib Burq <saburq@gmail.com>
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU General Public Licence. See the COPYING file.
11 *
12 **********************************************************************/
13
14#include <stdio.h>
15#include <stdlib.h>
16#include <string.h>
17#include "CUnit/Basic.h"
18
19#include "liblwgeom_internal.h"
20#include "cu_tester.h"
21
22static void
33
34static void
36{
37 /* Magic Linestring */
39 "SRID=4326;LINESTRING(33.6729 38.7071,33.6692 38.701,"
40 "33.6673 38.6972,33.6626 38.6871)",
41 5,
42 "k~fkFsvolEbe@bVvVzJb~@j\\");
43
44 /* Linestring */
46 "LINESTRING(-120.2 38.5,-120.95 40.7,-126.453 43.252)",
47 5,
48 "_p~iF~ps|U_ulLnnqC_mqNvxq`@");
49 do_encoded_polyline_test("LINESTRING EMPTY", 5, "");
50
51 /* MultiPoint */
53 "MULTIPOINT(-120.2 38.5,-120.95 40.7)", 5, "_p~iF~ps|U_ulLnnqC");
54 do_encoded_polyline_test("MULTIPOINT EMPTY", 5, "");
55}
56
57static void
59{
60
61 /* SRID - with PointArray */
63 "SRID=4326;LINESTRING(0 1,2 3)", 5, "_ibE?_seK_seK");
64
65 /* wrong SRID */
67 "SRID=4327;LINESTRING(0 1,2 3)", 5, "_ibE?_seK_seK");
68}
69
70static void
72{
73
74 /* Linestring */
76 "LINESTRING(-0.250691 49.283048, -0.250633 49.283376,"
77 "-0.250502 49.283972, -0.251245 49.284028, -0.251938 "
78 "49.284232, -0.251938 49.2842)",
79 6,
80 "o}~~|AdshNoSsBgd@eGoBlm@wKhj@~@?");
81
82 /* MultiPoint */
84 "MULTIPOINT(-120.2 38.5,-120.95 40.7)", 3, "gejAnwiFohCzm@");
85}
86
87/*
88** Used by test harness to register the tests in this file.
89*/
91void
93{
94 CU_pSuite suite = CU_add_suite("encoded_polyline_output", NULL, NULL);
98}
static uint8_t precision
Definition cu_in_twkb.c:25
void out_encoded_polyline_suite_setup(void)
static void do_encoded_polyline_test(char *in, int precision, char *out)
static void out_encoded_polyline_test_precision(void)
static void out_encoded_polyline_test_srid(void)
static void out_encoded_polyline_test_geoms(void)
#define ASSERT_VARLENA_EQUAL(v, s)
#define PG_ADD_TEST(suite, testfunc)
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
lwvarlena_t * lwgeom_to_encoded_polyline(const LWGEOM *geom, int precision)
void lwfree(void *mem)
Definition lwutil.c:248
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940