[geotk] Re: Get envelope for a scale

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Mon Sep 7 09:36:38 EDT 2009


Theuns Heydenrych a écrit :
> AffineTransform objectiveToDisplay = (AffineTransform) 
> mapWidget.getCanvas().getObjectiveToDisplayTransform();
> //Amount of inches in one meter
> double inchesInOneMeter = 39.3700787
> //physical size of pixel on screen
> double pixelPhysicalSize = (1/72.0) ;
> //physical size of screen pixel in meter
> double physicalSizeInMeter = pixelPhysicalSize / inchesInOneMeter;
> //The current scale of the projected map
> double currentScale = XAffineTransform.getScale(objectiveToDisplay);
> //The size of one pixel on the map in meter
> double onePixelInMeter = 1/currentScale ;
> //The map scale
> double MapScale = onePixelInMeter / physicalSizeInMeter ;
> 
> Result is then 1:MapScale

Yes I think it is about that. Sometime I do error by putting a division instead 
than a multiplication or vis-versa, but I think you will spot such mistake from 
the numerical values. At least all the required steps are as above (as far as I 
known).

	Martin



More information about the Geotoolkit mailing list