Is there a Possibility to directly write a HERE flexible-polyline into my Postgis/Postgres Database without Decoding, converting to Text and then make a Geometry using ST_MakeLine(ST_MakePoint(...) ? I am afraid that there is no possiblilty (other than with Google-encoded-Polyline). Or is there something to use?
Background: I am testing the HERE-API for routing. I have found the Java-source to Decode the resulting Polyline from Github: https://github.com/heremaps/flexible-polyline. Therefore I can read the coordinates from this flexxible-polyline-String
- flexible-Polyline:
BG8_9j7Cy11iXsBlBoBrEnBrErJrJzF3DnGvC7GnBvHoBjNkI7BrE7GvR7BjDrEvH_E3I_EvHvCrE3SnajNrTjIjNvHjN7G_OvHjSnGnQ_EzP_E_TrEnVrErYjDvWrEvgB7BnLjD_TvCjXjDvgB5D9qB - this results in the coordinates: (47.774718 / 12.102489) (47.77474 / 12.10247) (47.77476 / 12.1024) (47.77474 / 12.10233) .... (in the South of Germany)
- or as Postgis-Request:
ST_GeomFromText('LINESTRING(12.102489 47.774718, 12.10247 47.77474, 12.1024 47.77476, 12.10233...
My Request is:
But now I wanted to convert this Point-List to Postgis. I hoped to use an existing function, e.g. ST_LineFromEncodedPolyline from Postgis. Unfortunately this does not return valid results as it is based on the Google encoding/decoding algorythm. Results from ST_LineFromEncodedPolyline are (which clearly shows that it is a huge difference between these Polyline-compressions):
SELECT ST_AsEWKT(ST_LineFromEncodedPolyline('BG8_9j7Cy11iXsBlBoBrEnBrErJr.....
--Result:
SRID=4326;LINESTRING(0.00004 -0.00002,0.0042 -0.00015,0.00422 -0.00405,0.00431 -0.00104,0.0048 ...
Is there some way e.g. using a multiplier to get this geometry from the HERE-String?