RE: [mapserver-users] PHP MapScript pixel coordinates to map coordinates
Seems like noone have answered this yet... In fact, it is as easy as using proportions. Mapservers mapextent is given in units of the actual projection of the maƄ. If you need to have the extent in another projection, the cornerpoints can be reprojected. Morten -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Shorthouse, David Sent: Wednesday, January 20, 2010 4:57 AM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] PHP MapScript pixel coordinates to map coordinates Folks, This question has no doubt been asked many times, but for the life of me I cannot find a solution. Here's what I'm trying to do: I have a jQuery-based front-end that uses the wonderful jcrop extension (http://deepliquid.com/content/Jcrop.html) that helps coordinate zoom. I'm hoping to use this same front-end to permit cropping of a resultant map image, which means I need to pass the four pixel corner coordinates, convert to map coordinates (projection may be variable), then set the extent such that the resultant map image will have the same dimensions as that described by the user on the front-end. So, how can I convert pixel coordinates to map coordinates? Note that the map projection is not always DD so I cannot merely use proportions as I have seen in some solutions. Surely this is easier than I am making it out to be. Thanks for any advice, David Shorthouse ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] PHP MapScript pixel coordinates to map coordinates
Hi David, have you already tried with this conversion: $geo_x = $minx + (($pix_x / $map_width) * ($maxx- $minx)); $geo_y = $maxy - (($pix_y / $map_height) * ($maxy - $miny)); Daniel Am 20.01.2010 04:57, schrieb Shorthouse, David: Folks, This question has no doubt been asked many times, but for the life of me I cannot find a solution. Here's what I'm trying to do: I have a jQuery-based front-end that uses the wonderful jcrop extension (http://deepliquid.com/content/Jcrop.html) that helps coordinate zoom. I'm hoping to use this same front-end to permit cropping of a resultant map image, which means I need to pass the four pixel corner coordinates, convert to map coordinates (projection may be variable), then set the extent such that the resultant map image will have the same dimensions as that described by the user on the front-end. So, how can I convert pixel coordinates to map coordinates? Note that the map projection is not always DD so I cannot merely use proportions as I have seen in some solutions. Surely this is easier than I am making it out to be. Thanks for any advice, David Shorthouse ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- Daniel Degasperi Software Developer daniel.degasp...@r3-gis.com --- R3 GIS Srl Via Johann Kravogl 2 I-39010 Merano - Sinigo (BZ) Tel. +39 0473 494949 Fax. +39 0473 069902 Web http://www.r3-gis.com - ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] PHP MapScript pixel coordinates to map coordinates
Folks, This question has no doubt been asked many times, but for the life of me I cannot find a solution. Here's what I'm trying to do: I have a jQuery-based front-end that uses the wonderful jcrop extension (http://deepliquid.com/content/Jcrop.html) that helps coordinate zoom. I'm hoping to use this same front-end to permit cropping of a resultant map image, which means I need to pass the four pixel corner coordinates, convert to map coordinates (projection may be variable), then set the extent such that the resultant map image will have the same dimensions as that described by the user on the front-end. So, how can I convert pixel coordinates to map coordinates? Note that the map projection is not always DD so I cannot merely use proportions as I have seen in some solutions. Surely this is easier than I am making it out to be. Thanks for any advice, David Shorthouse ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users