[postgis-users] More details for errors

Nicolas Ribot nicolas.ribot at gmail.com
Tue Mar 27 05:29:17 PDT 2012


On 27 March 2012 08:02, Denis Rouzaud <denis.rouzaud at gmail.com> wrote:
> Hi Nicolas, hi all,
>
> Thanks for your reply.
>
> The problem is:
> - I cannot filter my view using where geometryType(wkb_geometry) =
> 'LINESTRING' as it will still return the same error
> - I cannot check the result of ST_LineMerge in the where clause since
> aggragates are not allowed in wheres
> - If I cast to a MULTI, I don't how to check that it is castable to a
> LineString.
>
> So, I'll try to reformulate:
> - Can I check if a MultiLineString is in fact a LineString ?
> - Is there a way to test the result of LineMerge to see if it is a
> LineString or MultiLineString?
>

Hi,
The number of elements in the collection will tell you if it is a
linestring (1 element): st_numGeometries(), or the geometry type
(geometryType() ) will start by 'MULTI' in case of collection.
You could add a rule on your view to disallow st_lineMerge results
producing MULTI elements.

Nicolas



More information about the postgis-users mailing list