[OSRS-PROJ] Orthographic Projections and MapServer

Frank Warmerdam warmerdam at pobox.com
Thu Aug 21 07:48:00 PDT 2003


Folks,

I thought I should summarize my findings on the problems that Tom H ran into
using an orthographic projection for a world image in MapServer.   While the
bugs are essentially in MapServer, there is a more general question for
projections folks so bear with me.

Basically, he was getting an image at this url, the extra triangles
representing some sort of bug:

   http://www.scriptsupport.co.uk/images/mapserv.png

The bug report is available at:

   http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=411

In tracking through, the problem is that MapServer wasn't checking error
results from pj_transform() properly.  Some points in the polygons were not
reprojecting because they were over the horizon but MapServer was not
checking whether msProjectPoint() was successful in msProjectLine(), and
msProjectShape() was not checking if msProjectLine() was successful. So
msDrawShape() proceeded to drawing polygons that were not successfully
reprojected to orthographic meters resulting in some or all points being
essentially at 0,0 (the center of the map).

I will commit changes to msProjectLine() and msProjectShape() to return
MS_FAILURE when any points fail to reproject, but this still leaves a question
as to what functions like msDrawShape() should do when a shape files to
reproject.  Should it be a fatal error?  If so, Tom's goal can't be accomplished
since there will always be some polygons that aren't completely reprojectable.
If we just skip drawing such shapes, but return MS_SUCCESS from msDrawShape()
then we get results like:

   http://mapserver.gis.umn.edu/bugs/attachment.cgi?id=60&action=view

As you can see some polygons (such as the continental United States) that
go over the horizon are completely dropped even though much of the polygon
would be visible.

So now the more general question for projection folks.  Does anyone have
a suggestion for how to plot polygons that partially go over the horizon?
What I want is a way to figure out what part of a polygon would be visible
and plot that.

One very crude solution I could imagine is to split polygons that don't
completely reproject successfully into chunks (perhaps 1degree x 1 degree
peices) and draw all of those that reproject.  That would give essentially all
the stuff that should be visible to the user, but it could be pretty messy to
implement, and it would be somewhat difficult to plot the original polygon
edges properly.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent


----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.



More information about the Proj mailing list