0

A MultiLineString is formed by a sequence of points and each point has latitude and longitude. Use the sql below to get the latitudes and longitudes of each point so that my MultiLineString:

SELECT
    St_AsText (ST_Transform("public"."Shapes".geom,4326)),
    "public"."Shapes"."id"
FROM
    "public"."Shapes"

Result

I want to get the sequence of points of each line in separate rows and lat / long in separate columns example:

   ID            pt_lat            pt_lon
   1001             lat1             lon1
   1001             lat2             lon2
   1001             lat3             lon3
   1001             lat4             lon4
   1001             lat5             lon5
   1001             lat6             lon6
   1002             lat1             lon1
   1002             lat2             lon2
   1002             lat3             lon3
   1002             lat4             lon4
   1002             lat5             lon5
   1002             lat6             lon6

I know I can do that consuming one GeoJSON for example, but want to know if there is a native function of PostGIS for this.

1 Answer 1

2

I would start by looking at ST_DumpPoints, and this question might also help.

So select the id, dump the points, using st_x and st_y to get the lon lat

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.