[mapserver-users] RE: is there such a thing as a pixel/screen projection?

Brent Fraser bfraser at geoanalytic.com
Fri Jan 23 13:03:33 EST 2009


Arthur,

  If I understand you, you want to submit output image pixel coords to a function/method and get out coordinates in the MAP file's coordinate system.  In general, this is a similarity transformation involving one scale, two translation values, and possibly a rotation value (if there is an ANGLE keyword in the MAP file, or applied via MapScript).

  Most likely your session's output would use a projected coordinate system (not geographic), so if you really wanted Lat/Lon values, you would then have to use a Proj4 function (exposed via Mapscript?) to do the inverse projection.

  The pixel/georef similarity values are stored in the map object (actually the six affine transformation parameters are stored, a super-set of the similarity).  And strangely, even though the simliarity calculation is done several places in Mapserver, there is a specific function to do this in mapobject.c named msMapPixelToGeoref with a message saying "msMapPixelToGeoref() not yet implemented".

  I'm not a Mapscript guy, so I don't know if you can get at the map object's geotransform values (likely not?).  May someone else could comment on that?  And they are really just a mathematically convenient way of storing the mapObj.cellsize, ANGLE (how come there's a setRotation method but no getRotation?), and extent.minx, extent.miny values.

Brent Fraser    

Arthur Clifford wrote:
> Greetings,
> 
>  
> 
> I was wondering whether there is a way to provide a proj4 string or 
> other method for specifying a projection where the units are in pixels 
> and screen width and height are provided? My desire is to use the 
> PointObj’s project function for forward and reverse projecting an x,y 
> screen coordinate. I find it odd that MapScript has great functions for 
> zooming and panning based on pixel values and the whole shpxy 
> functionality in the templating engine but lacks a way to convert a 
> pixel to lat/lon or other projection values. It would be one thing if 
> nothing in MapScript worked that way, but clearly something in the 
> code-base knows how to do the conversion. I find this especially odd 
> when the queryByPoint function requires a point object that explicitly 
> states it should be in projected not screen values. My google searches 
> thus far have pointed to useful formulae for doing the trick, but what’s 
> up with that?!  
> 
>  
> 
> I feel like I’m missing a less-than-obvious logic-leap that one is 
> supposed to just know to make by understanding the object model. I have 
> RTFM and I nothing I see suggests it is possible through php mapscript 
> objects to convert screen units to a target projection. If there are 
> tutorials or examples of how to do this I haven’t yet discovered any.
> 
>  
> 
> So, how does one, through php MapScript, get a lat/lon value for 
> projecting into projection values if a PointObj cannot be defined with 
> pixel values and the project functions take PointObj? Also, how would 
> one go about requesting a special screen-projection as a projection to 
> specify if something like that does not exist?
> 
>  
> 
> ArtC
> 
> Arthur Clifford
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list