Question: LINESTRING in hex format to LineString #2827
Replies: 3 comments
-
Hi @cvetelinandreevdreamix. Out of the box, Turf doesn't support any particular database or database storage format. Does this post look similar to what you're seeing? It might be that PostgREST doesn't understand PostGIS is storing coordinates in a special format, and is blindly returning what it think are numbers. Adapting your query according to some of the suggestions listed might be worth trying. Let us know how you go. |
Beta Was this translation helpful? Give feedback.
-
Hi @smallsaucepan, Thank you for the prompt reply and your time to investigate this. The 0102000020E61000003900000 is WKB. it is stored with The post is 8 years old and the wkx javascript library they suggest has its last release date for 5 years go (it requires some additional work in my angular app I don't want to mess up with). I created another column and put all the coords in JSON format until I find better solution. the WKB is much smaller in size than the JSON and I store significant amount of coords. |
Beta Was this translation helpful? Give feedback.
-
Gotcha. Unfortunately Turf deals pretty much exclusively in GeoJson, and doesn't offer out of the box support for WKT/WKB. Your best path forward would be to a) persist with wkx, or b) see if there is something in PostGIS that will give you parseable coords you can convert to GeoJson and pass to Turf. Maybe WKB -> ST_LinestringFromWKB -> your code to convert to GeoJson -> Turf ? |
Beta Was this translation helpful? Give feedback.
-
Hi all,
First of all, Thank you for being generous with your time and work here.
I'm storing coordinates in a geography column in PostGist. E.G LINESTRING (24.472381 42.984439, ...)
When I get it with PostgresT I get it in hex format in my angular app: 0102000020E61000003900000...
Can I convert the hex with turf so that I get a pairs of { lat: .., lng: ...} objects so I can display them on the google maps component as a polyline?
All the best, Tsvet.
Beta Was this translation helpful? Give feedback.
All reactions