[postgis-users] Converting Multilinestrings to Linestrings
worker201 at gmail.com
Fri May 7 02:57:09 PDT 2010
I'm pretty new at PostGIS, and this is my first post to the users list. I recently uploaded a street network into my database using the shp2pgsql function, in order to do some georeferencing for a transportation project. The streets network is composed of line segments going from intersection to intersection. I assumed these would be imported as linestrings. However, they have the geometry type multilinestring. Which seems inappropriate, because their format suggests that they are really just linestrings in disguise. To explain, here's a sample geometry:
MULTILINESTRING((1275799.56 245381.12,1275819.04 246040.71))
Ultimately, what I'd like to do is a simple line_interpolate_point - which seems like it would work if I could just get rid of that MULTI. Is there a way to force linestring data to be imported as a linestring instead of as a multilinestring? Is there a way to transform all the multilinestrings in a dataset into linestrings? Is there a way to convert a multilinestring into a linestring easily and quickly on the fly (I'm doing PHP/LAPP programming)? Another thought was that I could do string parsing on the text, and then pass the data to line_interpolate_point as a string, rather than an object - does that even work?
Thanks in advance for any advice you might have.
More information about the postgis-users