[postgis-users] question about order of geomcollfromtext()

strk at refractions.net strk at refractions.net
Tue Nov 29 11:45:58 PST 2005

Amit, in postgis-head there's a new interface to GEOS:

LineMerge accepts a geometry and construct lines from it.
In your case you could go:

	select linemerge(collect(the_geom)) from mytable;

Give it a try.


On Tue, Nov 29, 2005 at 11:43:19AM -0800, Amit Kulkarni wrote:
> I thought about posting to the geos list but I felt this is a PostGIS
> question.
> Background: Sometime ago I posted a possible solution for aligning all
> road segments in a particular direction to make sure their digitization
> order is 'right' in postgis-users list. I was using Hartmut's azimuth()
> function. Now I find it is not possible to use it in checking direction
> because it works very well if you have road segments lined up
> horizontally (I didn't check with only vertically aligned road
> segments), but not multiple road segments whose orientation changes
> sometimes from segment to segment while the actual road curves from
> horizontal to vertical (or vertical to horizontal)... The resulting
> angles change a lot giving false readings.
> So I decided to rewrite the func from scratch remembering that a
> startpoint of a segment is exactly similar (~= operator) to the
> adjacent segment's endpoint.
> There is a touches(), geometry_left, geometry_right and there is a
> inbuilt geom collection func. (Is collect() useful?)
> I am passing a street_name which has 100 road segments associated with
> that name, and the row_id of the first road segment (with the desired
> direction) to this function.
> Now my question is if I call geomcollfromtext() what is the order of
> the geometry segments when they are initially added while creating the
> geometry collection? Is it added such that when you iterate over the
> collection each geometry segment is adjacent to next? Or the order is
> random?
> I couldn't figure it out in the JTS/Geom code, many places call a
> createGeometryCollection(null). There is just one call in
> WKTReader.java/cpp which is in readGeometryCollectionText()
> Thanks in advance!
> __________________________________________
> Yahoo! DSL – Something to write home about.
> Just $16.99/mo. or less.
> dsl.yahoo.com
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


 /"\    ASCII Ribbon Campaign
 \ /    Respect for open standards
  X     No HTML/RTF in email
 / \    No M$ Word docs in email

More information about the postgis-users mailing list