Opened 15 years ago

#2864 new defect

Support for screen as a projection type

Reported by: artclifford Owned by: mapserverbugs
Priority: normal Milestone:
Component: MapScript-PHP Version: unspecified
Severity: normal Keywords:
Cc:

Description

The PHP MapScript API supports a project a function for both RectObj and PointObj classes called "project". However, there is no apparrent way to define screen units/dimenions as a projection for use with those functions.

Below is an example of what I think should be possible:

$projectionFrom = ms_newProjectionObj("+screen +width=200 +height=100 +units=pixels +dpi=72"); $projectionTo = ms_newProjectionObj($latLonProj4);
$pointObj = ms_newPointObj( 100 , 50 );
$poinObj->project( $projectionFrom, $projectionTo ); $latLonX = $pointObj->x; $latLonY = $pointObj->y;

The $projectionFrom entry is the only thing different from what can be done now. I'm not sure it would be advisable to make up a fake projection proj4 string like that, but in some way there needs to be a way to define a screen projection. An alternative might be:

$dpi=72;
$units="pixels";
$screenProjection = ms_newScreenProjection( $pxWidth , $pxHeight, $units, $dpi);

Given the shpxy capability in the templating engine and the zoom & pan funcitonality that allow pixel dimensions to be set it is clear that somewhere there is already the ablity to forward and reverse project to and from screen coordinates to other projections. Therfore, in theory, it should be a matter of encapsulating and exposing existing code to the API.

Adding this functionality would facilitate simple conversion of user interactions to meaningful values in a php context without having to re-engineer forward/reverse projecting in PHP which may or may not calculate the changes the same way the server would.

I listed it as a defect rather than an enhancement because the projection function(s) are incomplete without this ability within a web-mapping system.

When I mentioned this on the user list, a user (Tamas Szekeres) wrote the following:

"I would also support having those functions implemented in the mapserver core. Currently either the PHP or the SWIG interface use separate implementations for the same problem."

Change History (0)

Note: See TracTickets for help on using tickets.