35{
38 int length = strlen(encodedpolyline);
39 int idx = 0;
41
42 float latitude = 0.0f;
43 float longitude = 0.0f;
44
46
47 while (idx < length) {
49 char byte = 0;
50
52 char shift = 0;
53 do {
54 byte = encodedpolyline[idx++] - 63;
55 res |= (
byte & 0x1F) << shift;
56 shift += 5;
57 } while (byte >= 0x20);
58 float deltaLat = ((
res & 1) ? ~(res >> 1) : (
res >> 1));
59 latitude += deltaLat;
60
61 shift = 0;
63 do {
64 byte = encodedpolyline[idx++] - 63;
65 res |= (
byte & 0x1F) << shift;
66 shift += 5;
67 } while (byte >= 0x20);
68 float deltaLon = ((
res & 1) ? ~(res >> 1) : (
res >> 1));
69 longitude += deltaLon;
70
71 pt.
x = longitude/scale;
72 pt.
y = latitude/scale;
75 }
76
79
80 return geom;
81}
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *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.