[postgis-users] multilinestringm to linestring en masse?

Webb Sprague webb.sprague at gmail.com
Tue Oct 16 07:00:34 PDT 2007


Hi all,

I am sorry for relying so heavily on the list ... but I have a column
of geometries imported through shp2pgsql that are multilinestringm and
need to be plain old linestrings.

(1) How can I check en masse that this operation would be well
defined?  IE, that there is only a single linestring in each geom ,
etc?

(2) How can I do the conversion (ie which function for update
the_new_geom = FUNC(the_geom)?  I tried st_dump, but I can't even
figure out how to pull the geometry out of the returned pair.

(3) I want to do this so I can interpolate and edit the linestrings.
Is this the right way to go about setting up such a thing?

Some data/ results:

-- the data

or_gis=# select astext(the_geom) from hwys2006 where
hwyname='HATFIELD' and hwy_seg_id = 19644;

  astext
--------------------------------------------------------------------------------------------------------------------------------------------------------
 MULTILINESTRING((1032221.983 95706.992,1032248.7 95674,1032804.8
95003.1,1033343.7 94346.8,1033802.5 93781.1,1034597.6
92784.6,1034910.378 92332.902))

---  st_dump()

or_gis=# select astext(the_geom), st_dump(the_geom) from hwys2006
where hwyname='HATFIELD' and hwy_seg_id = 19644;
astext|MULTILINESTRING((1032221.983 95706.992,1032248.7
95674,1032804.8 95003.1,1033343.7 94346.8,1033802.5 93781.1,1034597.6
92784.6,1034910.378 92332.902))
st_dump|({1},0102000060B00B000007000000A8C64BF73B802F415A643BDFAF5DF7405C8FC2F5281C32406666666671802F4100000000A05BF7401E85EB51B81E32409A999999C9842F419A999999B131F74048E17A14AE47324066666666FF882F41CDCCCCCCAC08F740703D0AD7A370324000000000958C2F419A99999951E5F64052B81E85EB91324033333333CB922F419A99999909A7F64090C2F5285CCF32404C3789C13C952F41508D976ECE8AF640285C8FC2F5E83240)

-- an attempt at interpolation

or_gis=# select astext(the_geom),
astext(st_line_interpolate_point(the_geom, .5)) from hwys2006 where
hwyname='HATFIELD' and hwy_seg_id = 19644;
ERROR:  line_interpolate_point: 1st arg isnt a line
or_gis=#

Thanks again!
W



More information about the postgis-users mailing list