Software14
Software14

Reputation: 179

Java Postgis how to convert jts to coordinates

I have coordinates in my postgis database with the format shape geometry :

"0102000000020000000000000000000000000000000000000000000000000049400000000000005440"

How can I convert it in coordinates (x,y) in Java ?

Upvotes: 1

Views: 225

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247235

You can use PostGIS functions:

SELECT path[1] AS number,
       st_x(geom),
       st_y(geom)
FROM st_dumppoints(
        '0102000000020000000000000000000000000000000000000000000000000049400000000000005440'::geometry
     );

 number | st_x | st_y 
--------+------+------
      1 |    0 |    0
      2 |   50 |   80
(2 rows)

Upvotes: 1

Related Questions