[postgis-users] points to polyline or polygon
chodgson@refractions.net
chodgson@refractions.net
Tue Jul 15 23:12:41 2003
Actually, as I said, there is no way to know what order the collect function
will put them in (without looking into the internals of the database). In
addition, there is no way in postgis to turn a multipoint into a linestring -
so you're really no better off.
You may be able to make it work with collect, and if you tell mapserver that
the multipoint is really of type "line"... but don't blame me if stops working
when you upgrade to a new version postgis or mapserver.
Chris
Quoting Randy James <rjames57@yahoo.com>:
> Hi
>
> Well seems like it could work.
>
> I plan to use an autonumber to ensure the points are in the
> order the user clicked on the screen.
>
> Collect places them in the order it finds them i guess? If
> so the autonumber should work?
>
> Cheers
> Randy
> --- chodgson@refractions.net wrote:
> > You definitely do NOT want to do this - the COLLECT()
> > aggregate function
> > doesn't gauarantee any sort of order in the points it has
> > collected.
> > Furthermore, a Multipoint object is not necessarily
> > ordered (it will always
> > list the points in the same order, but not by necessity,
> > only because it is
> > simplest).
> >
> > The best way to solve this problem is to select your list
> > of points from the
> > table (they will also need to have an "order" column in
> > order to make sure they
> > are made into a line in the correct order) and use PHP or
> > your language of
> > choice to build a new WKT string.
> >
> > HTH.
> >
> > Chris
> >
> > > This is an interesting question to me. If I understand
> > correctly, you want
> > > to "cast" a set of points into a linestring. Getting
> > your list of points
> > > should be as easy as:
> > >
> > > SELECT COLLECT(the_geom) FROM mytable GROUP BY
> > somefield.
> > >
> > > But this returns the geometry as MULTIPOINT, which
> > isn't really want you
> > > want, but if you see the text representation, it does
> > look like a
> > > linestring:
> > >
> > > SRID=-1;MULTIPOINT(596681.75 5830977.5,532989.625
> > 5869892,547653.0625
> > > 5808612,608081.1875 5799629)
> > >
> > > So can anyone else give a pointer on taking the above
> > output and casting it
> > > into a linestring instead?
> > >
> > > Tyler
> >
> >
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users@postgis.refractions.net
> >
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>