I am trying to draw a bunch of lines overlaying the globe map in a WGS84 projection. To this effect I have created a PostGIS DB with a table that has one column containing linestring data.

My problem is that when I export it to WGS84 shapefile (either using pgsql2shp or adding a PostGIS layer directly in QGIS) the lines around the edges are drawn the wrong way.

For example:

Suppose you have a line that connects Tokyo to Los Angeles. I would expect it to go over the pacific, but it does not. Instead I see a line go over Asia, Europe, Atlantic, US and finally end at LA.

What I think is happening is that it's trying to keep the line contiguous in the WGS84 projection (which cuts the map in the middle of the Pacific Ocean), instead of picking the shortest route. How can I configure either PostGIS or one of the tools to do the right thing?

The right thing being:

A line segment goes from Tokyo to the right edge of the map, and another line segment picks up at the left edge of the map (same coordinate) and goes to LA.

Your Answer

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

Browse other questions tagged or ask your own question.