[mapserver-users] OGR data layer type - points and lines

Fawcett, David (MPCA) David.Fawcett at state.mn.us
Mon Dec 20 13:17:58 PST 2010


It took 4 whole days, but thanks to Sandro, Spatialite now has a MakeLine() function.

http://groups.google.com/group/spatialite-users/browse_thread/thread/20f8e907ae9226

The feature is in SVN, I am not sure if it will make it into the pending 2.4.0 release.  I am also not sure how the OGR driver works and if it can accept geometries created on-the-fly, or if they need to come from a geometry column.

David.

-----Original Message-----
From: Fawcett, David (MPCA) 
Sent: Friday, December 17, 2010 10:23 AM
To: 'Stephen Woodbridge'; Ian Walberg
Cc: mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] OGR data layer type - points and lines

Ian, 

I thought that there was a pretty simple answer to this, but it seems as though I have imagined some non-existing functionality.

Assuming that you have a Spatialite db containing a point data set, and you have a MapServer layer that draws this, I think that I have a solution for you.  (This also assumes that OGR supports reading linestrings from Spatialite).

PostGIS has the ST_MakeLine() function that allows you to create linestrings out of point geometries.  The current version of Spatialite doesn't have anything like this (although since I have mentioned it on the Spatialite list, it could be there soon...)


So, this SQL employs some workarounds, but may work:

SELECT LineFromText('LINESTRING(' || group_concat(X(geometry) || ' ' || Y(geometry), ',') || ')') FROM datapoints ORDER BY fix_date;

If performance is a problem, I would build a Spatialite line dataset and rebuild it every time your point dataset changes.    

David.




More information about the MapServer-users mailing list