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

Fawcett, David (MPCA) David.Fawcett at state.mn.us
Fri Dec 17 11:22:58 EST 2010


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.

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Stephen Woodbridge
Sent: Thursday, December 16, 2010 10:44 AM
To: Ian Walberg
Cc: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] OGR data layer type - points and lines

On 12/16/2010 10:51 AM, Ian Walberg wrote:
> Ah, ok let us look at that.
>
> I do believe the data source we have has data in the format POINT
> (-118.550003051999994 34.016666412399999).
>
> What is the format for line data?

I'm not sure, I have not used the OGR connection. Assuming it is 
returning WKT where points are:

POINT(-118.550003051999994 34.016666412399999)

then lines would be:

LINESTRING(-118.550003051999994 34.016666412399999,-118.560003051999994 
34.016666412399999,...)

-Steve

> Thanks
>
> Ian
>
> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org
> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Stephen
> Woodbridge
> Sent: Thursday, December 16, 2010 6:57 AM
> To: mapserver-users at lists.osgeo.org
> Subject: Re: [mapserver-users] OGR data layer type - points and lines
>
> I do not believe that this is possible.
> If you want to draw lines you have to create a data source the returns
> lines not points.
>
> The problem is that mapserver draws features and each point is a
> feature. It does not have a mechanism that can read a data source and
> aggregate the point features into a single line feature.
>
> I have seen posts on the PostGIS list for SQL that can do this. You
> might ask on the GDAL list if there is a way to do this. Or if you can
> use PostGIS, then you can find the SQL in the archives or ask again.
>
> -Steve W
>
> On 12/16/2010 1:00 AM, Ian Walberg wrote:
>> Hello list,
>>
>> Using an OGR connection to an sqlite data file we can get point and
>> labels to draw successfully.
>>
>> However when we try and draw a line using the point data we do not get
>> anything drawn.
>>
>> Layer details below.
>>
>> Thanks
>>
>> Ian
>>
>> LAYER
>>
>> NAME ogr_points
>>
>> STATUS DEFAULT
>>
>> TYPE point
>>
>> CONNECTIONTYPE OGR
>>
>> CONNECTION "points.sqlite"
>>
>> DATA "DataPoints"
>>
>> CLASS
>>
>> NAME "From OGR"
>>
>> COLOR 255 0 0
>>
>> STYLE
>>
>> SYMBOL 'City'
>>
>> SIZE 5
>>
>> COLOR 0 255 255
>>
>> END
>>
>> LABEL
>>
>> COLOR 255 255 255
>>
>> OUTLINECOLOR 0 0 0
>>
>> TYPE truetype
>>
>> FONT Unicode
>>
>> SIZE 16
>>
>> ANTIALIAS TRUE
>>
>> POSITION AUTO
>>
>> END # end of label
>>
>> END
>>
>> END
>>
>> LAYER
>>
>> NAME ogr_line
>>
>> STATUS OFF
>>
>> TYPE line
>>
>> CONNECTIONTYPE OGR
>>
>> CONNECTION "points.sqlite"
>>
>> DATA "DataPoints"
>>
>> CLASS
>>
>> STYLE
>>
>> COLOR 255 22 22
>>
>> WIDTH 2
>>
>> END
>>
>> END
>>
>> END
>>
>>
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list