Opened 18 years ago

Closed 18 years ago

#1530 closed defect (fixed)

[Grid] Grid layer don't display rounded values when zoomed in

Reported by: jlacroix Owned by: mapserverbugs
Priority: high Milestone: 4.8 release
Component: MapServer C Library Version: unspecified
Severity: normal Keywords:
Cc:

Description

Grid layers seem to define the place where they draw the grid on the map on in
weird way when zoomed in. It seems that when we are zoom-in to display less than
a degree on the map, the place where the grid layer place its grid lines is all
messed up.

Below is a sample mapfile to reproduce this problem. If you notice, the -87
degree is in the middle of the image. However, mapserver place the line of the
grid on -86D 56M 59S.

MAP
STATUS ON
SIZE 400 300
EXTENT -87.052494 49.738376 -86.925045 49.972017

WEB
  TEMPLATE "testmap.html"
  IMAGEPATH "/tmp/ms_tmp/" 
  IMAGEURL "/ms_tmp/"
END

LAYER
  NAME "gridlayer"
  TYPE LINE
  STATUS DEFAULT
  CLASS
    COLOR 0 0 0
    LABEL 
      COLOR 0 0 0
      SIZE SMALL
      OUTLINECOLOR 255 255 255 
    END
  END
  GRID  
    LABELFORMAT "DDMMSS"
    MININTERVAL .25
   END 
END # Layer
END # Map File


To add on the top of that, if you change the MININTERVAL to 1, there's no line
at all. Even if the -87 degree is right in the middle of the map.

Change History (4)

comment:1 by jlacroix, 18 years ago

<short_story>
The trick is to force MapServer to use the MININTERVAL when it define its axis
(DefineAxis()). I made some test and it works.

Does it fit in 4.8, or should I wait after the official release?
</short_story>
<long_one>
After some digging I found out the problem. It seems that mapserver try to
define the spacing by rounding up to decimal degree under the MININTERVAL value.
To see a good example of that, try to remove the MININTERVAL from the mapfile
above. You will see that mapserver try to put intervals of 0.025 degrees. And
when we force it to .25 or 1, it takes the first value available and draw a line
there.

To prevent that, we can force MapServer to define it's axis that are no less
than the MININTERVAL value. This way it will always use the right value. I made
some test here and it work well.

Does it fit in 4.8, or should I wait after the official release?
</long_one>

comment:2 by sdlime, 18 years ago

Milestone: 4.8 release
Since this is not a new feature but a true bug fix I think this can be included 
into 4.8. Do you want to handle?

Steve

comment:3 by jlacroix, 18 years ago

Status: newassigned
Yes I will take care of it.

comment:4 by jlacroix, 18 years ago

Resolution: fixed
Status: assignedclosed
We now use MIN/MAXINTERVAL  when defining the GRID interval and starting position.

Marking as FIXED
Note: See TracTickets for help on using tickets.