6

In PostGIS, what if anything controls the direction that topogeometry LINESTRINGs will have when converted to geometry?

It doesn't appear to be the order in which the edges are listed in the call to CreateTopoGeom. Which makes sense in the presence of loop edges, I guess, although presumably you could define the direction of a linestring that starts with a loop edge to be in the direction of that edge.

Is it even stable? If I do a bunch of edge splitting/healing, is it possible that the system will flip my linestrings that include those edges? If it's at least guaranteed to be stable I could include a should_be_reversed boolean column in the table that includes the linestring topogeometry column, and call ST_Reverse on the resulting geometry in a view?

  • Interesting question. You seem to suspect it is not stable. Do you have any test data you could post? – John Powell Nov 6 '14 at 8:40
  • Now I'm even more confused, because I just now realized that it always returns a MULTILINESTRING. So the question would be split into two parts: how does ST_LineMerge decide what order its result should be in, is the order of the individual linestrings within the MULTILINESTRING stable under split/heal. What I really need to know, I guess, is where is it safe to track direction-specific metadata about lines in a topology. (e.g. one way streets, though that isn't my actual use case) – Doug McClean Nov 7 '14 at 0:03
1

Line direction is created by line draw direction, that is, how the line was originally imputed. i.e. from point a to point b, you then have a direction, if handled as a multi segment line the the individual nodes may all have different draw directions against the overall trend of the line. Modeled logical you could create oo rules for your data base that imply a segment edge direction from the beginning node of a multi segment line to the end node. But the basic ascii is draw direction between to points that include no other points (a line) a basic unit of the point line polygon paradigm used in vector G.I.S. Another term for this is the flashlight effect.

0

Do you need to care? I looked at CreateTopoGeom documentation. If PostGIs cares about the order, then they will take care of it. Oracle Spatial is very picky about the order of the points in a line and the rings. If you run the function on the data that you have, and if you display that data baring any SRID conversion issues, then you should be good to go

  • The reason I care is because I have metadata associated with the edges that is direction-dependent, and I am trying to figure out where I am supposed to put it. (Think one-way streets, or asymmetric upload/download speeds.) – Doug McClean Nov 9 '14 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.