Opened 20 years ago

Closed 20 years ago

Last modified 20 years ago

#719 closed defect (fixed)

Rotated maps - embedded scalebar is incorrect

Reported by: dmorissette Owned by: warmerdam
Priority: high Milestone:
Component: MapServer C Library Version: 4.3
Severity: normal Keywords:
Cc: richard@…

Description

Richard Barahona wrote:
> Hello Frank,
> I have attached two pdf files (scale 1:1000) created from your
> application, one with no rotation and the second with an angle of 30°.
> The graphic scalebar of the latter pdf is not correctly calculated
> (see lower left). Only tested with the ANGLE parameter in mapfile.
> Is it a big effort to fix it?
> 

I quickly checked the code and I see that msDrawScalebar() does the following:

---
  map->cellsize = msAdjustExtent(&(map->extent), map->width, map->height);
  status = msCalculateScale(map->extent, map->units, map->width, map->height,
map->resolution, &map->scale);
---

If this is called during a map draw then it will calculate the scale based on
the extents after rotation.

Change History (5)

comment:1 by fwarmerdam, 20 years ago

Status: newassigned
Was there a supporting mapfile or anything showing how this occured?  Is
this a pure cgi/mapserv/.map situation or using mapscript?  Is the scalebar
"in image"? 

I skimmed through the code and it doesn't look like msDrawScalebar() is called
from within msDrawMap(), so in theory the scale should have been computed
properly.  Perhaps an exit from msDrawMap() is used that avoids the "putting 
back" the extents logic. 

comment:2 by dmorissette, 20 years ago

Richard uses an EMBEDded scalebar, and I believe he uses PHP MapScript but that
shouldn't matter. I forwarded you a new copy of his sample map showing the problem.

msEmbedScalebar() is called twice from msDrawMap()... (twice? that's odd...
unfortunately I got to run now and can't check that further)

comment:3 by fwarmerdam, 20 years ago

Ah yes, the problem is clear now.  

Thanks

comment:4 by fwarmerdam, 20 years ago

Resolution: fixed
Status: assignedclosed
I have committed a change to mapdraw.c to temporarily restore the original
extents (with proper scale) before calling msEmbedScalebar().  This seems to
resolve the problem. 

I have also updated the msautotest/gdal/rot_out.map test to include and embedded
scalebar so we will know if this breaks in the future. 


comment:5 by richard@…, 20 years ago

Cc: richard@… added
Note: See TracTickets for help on using tickets.