[postgis-users] Lines crossing longitude 180 -180

mark wynter mark at dimensionaledge.com
Tue Sep 24 19:13:53 PDT 2019


Hi Paul, in the past I've solved this type of problem using some plpgsql.
Create two polygon geometries covering longitudes 0 to180, and 0 to -180.
For polygon_geom, use ST_Intersection(polygon_geom, line_string_geom) to
split and keep the linestring contained by each polygon.  Then stitch the
two linestring geoms back to form a single multi-linestring feature using...
ST_Multi(ST_Union(wkb_geometry)

I've done something similar here...
http://dimensionaledge.com/bezier-curves-a-more-flexible-alternative-to-great-circles/

The related github code is here
https://github.com/dimensionaledge/cf_public/blob/master/tutorials/bezier_curve_flight_paths.sh


HTH
Mark



> Message: 1
> Date: Tue, 24 Sep 2019 07:18:22 +0000
> From: <paul.malm at lfv.se>
> To: <postgis-users at lists.osgeo.org>
> Subject: [postgis-users] Lines crossing longitude 180 -180
> Message-ID: <785199B14156764C8EB14EF96CEDC44EE3FAB7 at xw-exch03.lfv.se>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,
> I'm creating a table with LineStrings in SRID 4326 from lines with
> coordinates like this:
> S37323578E178560795
> S38161687W179595994
> S38270000W179440000
> S38414463E179595994
> S39394800E178553000
> S40224800E178060600
> S41504422E176164722
> S42513000E175030000
> S43372622E174062536
> S45135100E172134000
> S48090000E168160000
> S45550000E165180000
> S42254200E169201800
> S41580000E169501800
> S41253091E170232389
> As you can see the crosses 180/-180 longitude several times which results
> in long line segments all over the map from east to west.
> Is there anyone who have solved this problem in a fairly easy way?
> I appreciate all help I can get.
>
> Kind regards,
> Paul Malm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190925/b54eafdc/attachment.html>


More information about the postgis-users mailing list