<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Yes, it is 2.0<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="http://postgis.refractions.net/documentation/manual-svn/ST_CollectionHomogenize.html">http://postgis.refractions.net/documentation/manual-svn/ST_CollectionHomogenize.html</a><br>
<br>
Well, I am turning around the problem...<br>
I have to do a cast, as I used
ST_Multi(ST_LineMerge(ST_Union(wkb_geometry)))::geometry(MultiLineString,xxx)
in the first view to prevent errors of unconnected lines.<br>
<br>
Right now the best solution I have is to let the view being
unusable, and another view to report errors.<br>
This is not very satisfying as if a problem occurs, I cannot use my
view until I fix the geometric errors.<br>
<br>
Basically, I need to compute a view with a LineMerge returning
LineString (i.e. leaving away features leading to MultiLineString)
and another view returning IDs of features leading to MULTI. <br>
<br>
I thought about using ST_Touches but it only uses two geometries and
I can have more in the LineMerge. No idea what to look for...<br>
<br>
Thanks for your help. I could go deeper in the problem!<br>
<br>
Greetings<br>
<br>
Denis<br>
<br>
<br>
<br>
<br>
<br>
On 03/27/2012 04:39 PM, Nicolas Ribot wrote:
<blockquote
cite="mid:CAGAwT=0tNZA3ZHd+qJko0-g-kZ7PMmzFP0cM2Zbpd6Wqpwg1tA@mail.gmail.com"
type="cite">
<pre wrap="">On 27 March 2012 16:09, Denis Rouzaud <a class="moz-txt-link-rfc2396E" href="mailto:denis.rouzaud@gmail.com"><denis.rouzaud@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi Nicolas,
Thanks again.
Well, this working, but this not performant...
Based on your suggestion, I tried this:
in view1:
ST_Multi(ST_LineMerge(ST_Union(wkb_geometry)))::geometry(MultiLineString,21781)
AS wkb_geometry
Then in view2:
ST_CollectionHomogenize(wkb_geometry)::geometry(LineString,21781) AS
wkb_geometry
FROM view1
WHERE ST_NumGeometries(wkb_geometry) = 1;
And I can detect problems by doing:
SELECT id FROM view1 WHERE ST_NumGeometries(wkb_geometry) != 1;
But this is slowing down a lot.
I think that the ST_CollectionHomogenize is not the right way. Is there a
better function to transform multiline to line if I am sure I only have
lines?
</pre>
</blockquote>
<pre wrap="">
I did not know this function. 2.0 ?
You can simply do:
st_setsrid(ST_geometryN(wkb_geometry), 21781) AS
wkb_geometry
FROM view1
WHERE ST_NumGeometries(wkb_geometry) = 1;
If geoms come from linemerge, no need to cast to a linestring. It is
already one.
Nicolas
_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
</pre>
</blockquote>
</body>
</html>