0

I want to calculate the general orientation of a multilinestring, I used this script to compute the orientation of a linestring :

ST_Azimuth( ST_Transform(ST_SetSRID(ST_Point(ST_XMax(OSM_geom),ST_YMax(OSM_geom)),2154),432), ST_Transform(ST_SetSRID(ST_Point(ST_XMin(OSM_geom),ST_YMin(OSM_geom)),2154),4326)));

but I don't know how to generate the global orientation of a multilinestring.

Simple Orientation :

simple orientation :

Global Orientation :

Global orientation

  • 1
    Please edit the question to include a more complete description of what you mean by "orientation" and "global orientation" along with a graphic that demonstrates both simple and complex cases. – Vince Aug 5 '16 at 11:14
1

Pease provide an example of MULTILINESTRING that is not working.

Your statement works fine when I use the following MULTILINESTRING:

SELECT ST_Azimuth(
                ST_Transform(
                        ST_SetSRID(
                                ST_Point(
                                        ST_XMax(OSM_geom),
                                        ST_YMax(OSM_geom)),2154),4326),
                ST_Transform(
                        ST_SetSRID(
                                ST_Point(
                                        ST_XMin(OSM_geom),
                                        ST_YMin(OSM_geom)),2154),4326)
                                        )
FROM ST_GeomFromText('MULTILINESTRING((-3.16420835153456 55.9269166007097,-3.164222 55.926918),
(-3.16431770120536 55.9257327846001,-3.16431547242401 55.925871759829),
(-3.164339 55.925777,-3.16431770120536 55.9257327846001))') as OSM_geom;

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.