[postgis-users] Reasonable Way to Convert MULTIPOINT to POINT?

Jeff Maki jmaki at andrew.cmu.edu
Wed Feb 23 18:24:16 PST 2005


All,

I'm new to the whole GIS thing, so bear with my (perhaps dumb) questions--I 
have a query that searches for the intersection of two roads (which are 
MULTILINES or LINES?), using the Intersection() function, and for most of 
them, a simple POINT() is returned. Which I have a column in another table 
that happily stores the result. The problem: one combination of streets, 
perhaps more than one (that I don't know about yet), returns a 
MULTIPOINT(). This can't go into my POINT() column. Plus, other queries 
rely on the storage column only being a POINT(). It has to be a POINT(), 
basically.

Short of changing the WKT POINT/MULTIPOINT identifier, and taking the first 
two, discarding the other points (i.e. hacking together a new WKT format) 
what's the best way to convert between these two primitives? Looking at the 
documentation, I see it says not to put in GeometryCollections into 
Intersection(). I think I do this when I input columns that have been 
Collect()'d. Is that the problem? It seems to work 99% (number made up!) of 
the time, though--just this one failed combo (so far).

Help!

Thanks!

-Jeff.



More information about the postgis-users mailing list