[postgis-users] MultiPoint to CircularString to LineString
Denis Rouzaud
denis.rouzaud at gmail.com
Fri Jan 13 00:56:37 PST 2012
Hi all,
I spend some time to convert a MultiPoint geometry to a circularString
then to a LineString (since qgis does not handle circularstring). I
achieved this by extracting all coordinates from the MultiPoint, then
concatenating them into a CircularString and finally convert it to a
Linestring. Here is the sql:
SELECT
ST_CurveToLine(ST_GeomFromText('CIRCULARSTRING('||left(tsum(ST_X(ST_GeometryN(wkb_geometry,n))||'
'||ST_Y(ST_GeometryN(wkb_geometry,n))||','),-1)||')'),12) AS wkb_geometry
FROM mytable
CROSS JOIN generate_series(1,100) n
WHERE n <= ST_NumGeometries(wkb_geometry)
GROUP BY id;
where tsum is an aggregate:
CREATE AGGREGATE distribution.tsum ( BASETYPE = text, SFUNC = textcat,
STYPE = text, INITCOND = '' );
I use this sql in a view(ie I have my multipoint table, and my
linestring view).
This apparently works but when I load the layers in qgis I have a
postgis error for the view: ERROR: current transaction is aborted,
connands ignored until end of transaction block.
So, here are my two questions:
1. Does someone know why I have an error in qgis?
2. Does someone have a smarter/better idea to create a curved linestring
from a multipoint?
The whole SQL code to create table and view is here
https://github.com/3nids/qWat/blob/a281ccaccfb0e246d9753f075b1a85f46c4a4eea/sql/dimension.sql
Thanks a lot!!!
Denis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120113/7fb6d00a/attachment.html>
More information about the postgis-users
mailing list