Lines from Point Geoms

346 views
Skip to first unread message

David Fawcett

unread,
Dec 16, 2010, 1:40:02 PM12/16/10
to SpatiaLite Users
I am sure that this is really a basic question, but I can't seem to
find the documentation that I am looking for.

I am looking for the function to use to create linestring geoms from
existing point geoms. I am aware of all of the functions for creating
line from WKB or WKT, so I just assumed that there are functions do do
this directly from point geoms.

I am sure that I can just flop them from geoms to WKB using AsBinary()
and then use LineFromWKB() to build new linestring geoms, but this
seems a little inefficient.

Are there functions to do this directly with Spatialite point geoms?

Thanks,

David.

a.fu...@lqt.it

unread,
Dec 16, 2010, 1:59:22 PM12/16/10
to spatiali...@googlegroups.com
On Thu, 16 Dec 2010 12:40:02 -0600, David Fawcett wrote

> Are there functions to do this directly with Spatialite point geoms?
>

Hi David,

I'm really sorry, but OGC-SFS has absolutely
nothing like this

A little bit of not-sql code is absolutely
required to perform such task (C, python ...)

bye Sandro

David Fawcett

unread,
Dec 16, 2010, 3:08:00 PM12/16/10
to spatiali...@googlegroups.com
Interesting. It seems like such a logical use case.

Thanks Sandro!

David.

> --
> You received this message because you are subscribed to the Google Groups "SpatiaLite Users" group.
> To post to this group, send email to spatiali...@googlegroups.com.
> To unsubscribe from this group, send email to spatialite-use...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/spatialite-users?hl=en.
>
>

Alex Mandel

unread,
Dec 16, 2010, 5:32:43 PM12/16/10
to spatiali...@googlegroups.com
David,

This has been on my wishlist for quite some time in general for FOSSGIS.
http://www.qgis.org/wiki/Google_Summer_of_Code_2010#Basic_Vector_Conversions.2C_Manipulations

Take a look at the Points2One plugin in QGIS which is intended for
Points to Polygon but could probably be hijacked.

I also know at least 2 people who have R code that does this and I'll
try to get a copy.

Down the road aggregation functions in SQL would be awesome, but I think
we'll need a c coder to step in and set that up.

Thanks,
Alex

David Fawcett

unread,
Dec 16, 2010, 10:07:40 PM12/16/10
to spatiali...@googlegroups.com
Alex,

I know that this functionality also exists in PostGIS in
ST_MakeLine(). I don't know if it is based on Postgres functionality
that doesn't exist in Sqlite.

http://postgis.org/documentation/manual-1.5SVN/ST_MakeLine.html

I hesitate to even mention this because somewhere in the back of my
head, I imagine Sandro skipping his sleep tonight and implementing
it...

David.

a.fu...@lqt.it

unread,
Dec 17, 2010, 4:50:48 AM12/17/10
to spatiali...@googlegroups.com
On Thu, 16 Dec 2010 21:07:40 -0600, David Fawcett wrote

Hi David,

> I hesitate to even mention this because somewhere in the back of my
> head, I imagine Sandro skipping his sleep tonight and implementing
> it...
>

Do you see ? it's definitively confirmed,
you are a sorcerer :-)

anyway, you are only half-way right:
a) yes, I actually skipped (part of) my sleep tonight
b) but not at all because I was working on ST_MakeLine
I'm currently deeply busy with TopoGML 3.1.1 parsing
[optimizing huge GML file processing: > 2GB] :-)

seriously speaking: really a good suggestion.
the next release will support ST_MakeLine for
sure (and it seems quite easy to be implemented).

bye Sandro

a.furieri

unread,
Dec 20, 2010, 4:00:11 PM12/20/10
to SpatiaLite Users
already implemented in SVN:

a) as simple segment connecting two POINTs:

SELECT AsText(MakeLine(MakePoint(1, 1),
GeomFromText('POINT(10 10)')));

b) as aggregate function:

CREATE TABLE pts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
line_id INTEGER NOT NULL);
SELECT AddGeometryColumn('pts', 'geom', 4326, 'POINT', 'XY');

INSERT INTO pts (id, line_id, geom)
VALUES (NULL, 1, MakePoint(0, 0, 4326));
INSERT INTO pts (id, line_id, geom)
VALUES (NULL, 1, MakePoint(10, 10, 4326));
INSERT INTO pts (id, line_id, geom)
VALUES (NULL, 1,
GeomFromText('POINT(10 1)', 4326));

SELECT MakeLine(geom)
FROM pts
GROUP BY line_id;

bye Sandro

David Fawcett

unread,
Dec 20, 2010, 4:19:56 PM12/20/10
to spatiali...@googlegroups.com
Well Alex, apparently, 'ask and you shall receive'...

Excellent work Sandro!

David.

Reply all
Reply to author
Forward
0 new messages