[OSRS-PROJ] Orthographic Projections and MapServer

Bart Adriaanse B at rt.nl
Thu Aug 21 13:14:02 EDT 2003


I remember having tried to tackle this problem about a year ago in a
different context but i gut stuck at about this point.

One solution would be to somehow detect the points which are beyond the
horizon and project those to lie on the horizon instead, this would
potentially render some polygon border lines at the horizon which shouldn't
really be there, but it seems like a good compromise.

However, even befor thinking about how to reproject them to the horizon, i
had problems detecting which points were beyond the horizon to begin with,
they end up being projected to the center of the earth  somehow, but the
flat, projected plane there might be valid coordinates ending up at this x,y
coordinate. It would help if pj_transform could label individual coordinates
as "unprojectable" by assigning something like -99999999, but that of course
is just a small part of the solution.

I remember ESRI projection engine solves this by projecting these points to
the horizon by default, maybe GTCP would contains some tricks we all could
learn from here ? Actually Gerald Evenden replied to my posts in this forum
back then saying he would not consider this a task for the projection engine
and the application using it should deal with this, but it would be mighty
helpfull if a projection engine could like "project" them to the horizon in
my perception ;-)

Best regards,

Bart Adriaanse

----- Original Message ----- 
From: "Frank Warmerdam" <warmerdam at pobox.com>
To: "PROJ.4 Discussion" <osrs-proj at remotesensing.org>; "UMN MapServer"
<mapserver-users at lists.gis.umn.edu>
Sent: Thursday, August 21, 2003 4:48 PM
Subject: [OSRS-PROJ] Orthographic Projections and MapServer

> Folks,
> I thought I should summarize my findings on the problems that Tom H ran
> using an orthographic projection for a world image in MapServer.   While
> 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
> 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
> 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
> since there will always be some polygons that aren't completely
> If we just skip drawing such shapes, but return MS_SUCCESS from
> 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
> the stuff that should be visible to the user, but it could be pretty messy
> 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.

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

More information about the Proj mailing list