Create an LWGEOM object from an Encoded Polyline representation.
- Parameters
-
encodedpolyline | the Encoded Polyline input |
Definition at line 32 of file lwin_encoded_polyline.c.
36 int length = strlen(encodedpolyline);
40 float latitude = 0.0f;
41 float longitude = 0.0f;
45 while (idx < length) {
52 byte = encodedpolyline[idx++] - 63;
53 res |= (
byte & 0x1F) << shift;
55 }
while (
byte >= 0x20);
56 float deltaLat = ((
res & 1) ? ~(
res >> 1) : (
res >> 1));
62 byte = encodedpolyline[idx++] - 63;
63 res |= (
byte & 0x1F) << shift;
65 }
while (
byte >= 0x20);
66 float deltaLon = ((
res & 1) ? ~(
res >> 1) : (
res >> 1));
67 longitude += deltaLon;
69 pt.
x = longitude/scale;
70 pt.
y = latitude/scale;
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,...
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
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().