I have a table of linestrings (OSM roads, in fact) that I'm displaying on a map. I want to filter them so that only those within a certain area are displayed- I've already done this with the coastline (a table of polygons) with great success, just using ST_Intersection
. However, that doesn't appear to work on the linestrings. When I try something like this:
ST_Intersection(way,st_geomfromtext('POLYGON(([etc]))',900913))
I get the following:
Error : ERROR: Geometry type (MultiLineString) does not match column type (LineString)
Presumably the ST_Intersection is returning multiple lines rather than the single one I am expecting- but not all do, because if I change the column to be MultiLineString then it complains that it can't insert a LineString.
How can I ensure that these MultiLineStrings and Linestrings are the same type, and can all be inserted together?