How to show lines between PostGIS data of type POINT

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Tue Nov 8 23:23:37 EST 2005


Hi Russ,

Have you looked at 
http://ms.gis.umn.edu/community/conferences/MUM3/workshop/postgis/

this is a great intro to PostGIS and mapserver.

If your points are in a table as point geometry (as apposed to a lat and 
lon column) then you can doe something like:

select setsrid(makeline((select the_geom from points order by id)), 4326);

if you data is in lat, lon columns then:

select setsrid(
          makeline(
            (select setsrid(
                      makepoint(log,lat), 4326
                    )
               from points order by id
             )
          ), 4326
        );

you may need to change the SRID from 4326 to whatever your data is in.

-Steve

Russ Bradford wrote:
> Hi list,
> I too have a database filled with point data for which I would like
> to "join-the-dots". Would anyone have a working example of how to do this
> using MapServer and PostgreSQL that they would like to share? The original
> thread here mentioned looking into Collect(), MakeLine() and AddPoint(). I
> have searched through the documentation and come up blank with all except
> Collect(). And being very new to MapServer (and PostgreSQL) I would like a
> little more direction in how to apply these solutions. If it makes any
> difference, I am using a Windows machine with Apache and the latest
> version of Mapserver.
> Cheers, Russ.
> 
> 
> On Tue, 26 Jul 2005 08:50:52 -0500, David Bitner <osgis.lists at GMAIL.COM>
> wrote:
> 
> 
>>To show lines but query points, you would need to have your data in
>>Mapserver as both lines and points.  To convert your points to lines
>>in Postgis (can be done on the fly) look into Collect(), MakeLine(),
>>and AddPoint().  You'll need to be sure to order your points by
>>timestamp before aggregating them to the line.
>>
>>On 7/26/05, Sebastian Albrecht <albrecht at fielax.de> wrote:
>>
>>>Hello,
>>>
>>>is it possible to show lines between POINT data results from a
>>>PostGIS-DB? Is it possible to somehow convert one point and the next
>>>one following to a line on-the-fly each time the Mapserver queries the
>>>database?
>>>
>>>My problem is I have a lot of single latlon points which have
>>>different timestamps and further values. The user should be able to
>>>query these values of a single point but lines should be shown in the
>>>map. Using a LINE type would not be very consistent because the user
>>>would not know which end of the line is the point the values belong
>>>to.
>>>
>>>One knows something? ;)
>>>
>>>Best regards,
>>>Sebastian
>>>
> 
> 



More information about the mapserver-users mailing list