[Gdal-dev] Tool to convert shapefile from [-180, 180] to [0, 360] range

Charles Wivell Charles.Wivell at dnr.state.mn.us
Thu Jun 15 12:17:17 EDT 2006


Oh the joys of displaying a 3D object onto a 2D display....


A well written app should be able to handle any longitude you supply (-240 or 495 degrees, should be just fine, but it might ask the user if they are sure...). A well written app should do all the calculations in 3D math for such large area datasets. It only becomes a problem when you are trying to display the 3D object. The app should allow the user to define the origin of the map. If you have lines that cross the -180/180 boundary, you should be able to choose the origin of the map so that the lines don't break. Such as, choose the left edge as 0 degrees longitude, center is 180/-180 and right edge is 360/0. This origin will break lines that cross the 0/360 boundary. If you have polygons all over the globe/planet, some will break, but the display software should handle the splitting for you...

In the apps I write I convert every longitude to between 0 and 360 (really between 0 and 2 Pi).

A programmer should have a set of units that they ALWAYS work/program in. I use the metric units and radians.... 

This would have saved the Mars spacecraft that crashed into Mars, if both contractors would have been working in the same units. Or if someone would have just checked (if they had an idea of what the ISP should be for a given fuel in the units they required as input) the outputs from one contractor that were inputs to the other....

I did a program for the Navy and they wanted the output in kilo-feet for altitude and nautical miles for range.... So you convert on input and convert on output.

Ok, I'll get off my soap box now....


Chuck Wivell



>>> "Curt, WE7U" <archer at eskimo.com> 6/15/2006 10:02 AM >>>
On Thu, 15 Jun 2006, Charles Wivell wrote:

> The shift you should use if you want the values between -180 and
> 180 for values less than -180 would be:

I'm not interested in the conversions in this case as they're
trivial.

Are apps normally designed to handle 0-360 or are files expected to
conform to -180 to +180?  I have two types of files now that don't
correspond to -180 to +180.  I understand that for other planets it
is common to do the 0-360 thing.

Also these questions:

> *) What should an application do with a shapefile that contains
> polygons with longitudes in the -189.9 to -180.0 range?  Is there an
> easy way to split up the shapes so they don't fall off the edge of
> the earth?

Note:  Our app uses unprojected lat/long in WGS84 only for display.
-180 is the left edge, +180 is the right edge (if zoomed out far
enough to see them both).  Drawing polygons or lines that cross the
180 boundary is a big hassle, we'd have to split them before
drawing.

--
Curt, WE7U.   APRS Client Comparisons: http://www.eskimo.com/~archer 
"Lotto:    A tax on people who are bad at math." -- unknown
"Windows:  Microsoft's tax on computer illiterates." -- WE7U
"The world DOES revolve around me:  I picked the coordinate system!"
_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org 
http://lists.maptools.org/mailman/listinfo/gdal-dev





More information about the Gdal-dev mailing list