31 #include "../postgis_config.h"
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.
This library is the generic geometry handling section of PostGIS.
LWGEOM * lwgeom_from_encoded_polyline(const char *encodedpolyline, int precision)
Create an LWGEOM object from an Encoded Polyline representation.