Create an LWGEOM object from an Encoded Polyline representation.
- Parameters
-
encodedpolyline | the Encoded Polyline input |
Definition at line 34 of file lwin_encoded_polyline.c.
38 int length = strlen(encodedpolyline);
42 float latitude = 0.0f;
43 float longitude = 0.0f;
47 while (idx < length) {
54 byte = encodedpolyline[idx++] - 63;
55 res |= (
byte & 0x1F) << shift;
57 }
while (
byte >= 0x20);
58 float deltaLat = ((
res & 1) ? ~(
res >> 1) : (
res >> 1));
64 byte = encodedpolyline[idx++] - 63;
65 res |= (
byte & 0x1F) << shift;
67 }
while (
byte >= 0x20);
68 float deltaLon = ((
res & 1) ? ~(
res >> 1) : (
res >> 1));
69 longitude += deltaLon;
71 pt.
x = longitude/scale;
72 pt.
y = latitude/scale;
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
References LW_FALSE, lwgeom_add_bbox(), lwline_construct(), POINT4D::m, precision, ptarray_append_point(), ptarray_construct_empty(), window::res, POINT4D::x, POINT4D::y, and POINT4D::z.
Referenced by do_encoded_polyline_test(), and line_from_encoded_polyline().