pgr_textToPoints¶
Name¶
pgr_textToPoints
- Converts a text string of the format “x,y;x,y;x,y;...” into and array of point geometries.
Synopsis¶
Given a text string of the format “x,y;x,y;x,y;...” and the srid to use, split the string and create and array point geometries.
The function returns:
integer pgr_textToPoints(pnts text, srid integer DEFAULT(4326))
Description¶
Paramters
pnts: | text A text string of the format “x,y;x,y;x,y;...” where x is longitude and y is latitude if use values in lat-lon. |
---|---|
srid: | integer The SRID to use when constructing the point geometry. If the paratmeter is absent it defaults to SRID:4326 . |
History
- New in version 2.1.0
Examples¶
select st_astext(g) from (
select unnest(
pgr_texttopoints('0,0;1,1;1,0;0,1;1,4;1,5;0,4;0,5', 0)
) as g
) as foo;
st_astext
------------
POINT(0 0)
POINT(1 1)
POINT(1 0)
POINT(0 1)
POINT(1 4)
POINT(1 5)
POINT(0 4)
POINT(0 5)
(8 rows)
See Also¶
- pgr_pointToEdgeNode - convert a point geometry to a
node_id
based on closest edge. - pgr_pointsToVids - convert an array of point geometries into vertex ids.