Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#1127 closed defect (fixed)

Text sizing wrong on rotated maps.

Reported by: warmerdam Owned by: warmerdam
Priority: high Milestone:
Component: MapServer C Library Version: 4.4
Severity: normal Keywords:
Cc:

Description

When maps with labels are rotated the text may end up being much smaller or
larger.  This may relate to "SIZEUNITS" but basically the problem is that
the rotation hack coordinate system is being used to derive some sort of 
label scaling information when that is inappropriate.

I will append a map demonstrating the problem when I am able to prepare one.
The original issue was raised by Flavio Hendry of Tydac AG.

Attachments (1)

bug1127.zip (135.3 KB ) - added by fwarmerdam 19 years ago.
mapfile + data demonstrating problem.

Download all attachments as: .zip

Change History (5)

comment:1 by fwarmerdam, 19 years ago

Owner: changed from sdlime to fwarmerdam
Summary: Text sizing wrong on rotated maps. Text sizing wrong on rotated maps.
Taking this myself.  I am also going to attach a map demonstrating the 
problem.  If you render the map with "shp2img -m test.map -o out.png" you
will get small but readable text.  If you add ANGLE 30 in the header and 
then re-render you get huge text.


by fwarmerdam, 19 years ago

Attachment: bug1127.zip added

mapfile + data demonstrating problem.

comment:2 by fwarmerdam, 19 years ago

Status: newassigned
I have confirmed that the issue does relate to SIZEUNITS.  I constructed 
a case without SIZEUNITS and label size was the same with or without an angle.

comment:3 by fwarmerdam, 19 years ago

Resolution: fixed
Status: assignedclosed
There is a location in msPrepareImage() in mapdraw.c where scalefactor is
computed.   For non MS_PIXELS SIZEUNITS the calculation includes map->cellsize.
However, for rotated images (or non-square WMS requests) at this point the cell
size is replaced by 1.0 for the fake coordinate system used.   This means
the scalefactor is computed incorrectly.

I have modified the code in this case to compute the cellsize from the original
(saved) extents.   I would add it uses the length of the cell diagonal divided
by the square root of 2 as the cellsize so it will be influenced by both the
x and y cellsize in non-square cases.  Based on the way the cell size is 
computed from the map extents it seems vaguely possible that the scale factor
would change a bit as the map is rotated but I am not sure about this.  There
was no *obvious* effect in this regard.

I have committed my fix in mapserver 4.4.1 and mapserver 4.5.  Please feel
free to update from CVS and test.  

I would add that there is a similar computation in the query map generation
function (msDrawQueryMap()) but I did not update this as I do not know how to
excercise the query map functionality and I'm not sure the same issues apply
there. 

I am closing this bug, but please re-open if you see the problem persists. 

comment:4 by dmorissette, 19 years ago

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