Opened 19 years ago

Closed 18 years ago

#1256 closed defect (fixed)

LABELFORMAT of the GRID Object no longer accepts a value of 'DD'

Reported by: kenlord@… Owned by: sdlime
Priority: high Milestone: 4.6 release
Component: MapServer C Library Version: 4.4
Severity: normal Keywords:
Cc: jmckenna@…, dgadoury@…

Description

The LABELFORMAT item of the GRID Object is documented to accept the following 
values:

DDMM = label the grid using degrees and minutes
DDMMSS = label the grid using degrees, minutes, and seconds
default = label the grid using a decimal value in the units of the projection 
used.

Mapserver 4.2 used to accept another undocumented value:
DD = label the grid using degrees (no decimal, no minutes, just the whole 
number of degrees)

Mapserver 4.4 no longer accepts this undocumented value, and crashes with an 
error message.

It would be very useful to be able to use the DD value again.  It gave a nice 
clean labelling of the grid lines without cluttering it all up with unwanted 
decimals, minutes, or seconds.

Why force me to label a grid line as "145.00" or "145 00" when the old system 
allowed me to place a nice clean "145" that didnt waste space on the map?

Thank you,
Ken Lord
Vancouver BC

Change History (19)

comment:1 by sdlime, 19 years ago

Cc: mapserver-bugs@… added
Component: MapServer CGIMapServer C Library
Summary: LABELFORMAT of the GRID Object no longer accepts a value of 'DD' LABELFORMAT of the GRID Object no longer accepts a value of 'DD'
I didn't make any changes in this area. Anyone else?

Steve

comment:2 by dmorissette, 19 years ago

I'm not aware of any change and I don't see anything obvious in CVS logs either.

comment:3 by dgadoury@…, 19 years ago

I realize this is not a critical issue, but are there any plans to restore the
DD option? I ran into the same issue with unwanted extra digits and would love
to be able to show only the DD value.

comment:4 by sdlime, 19 years ago

Will try and look before the 4.6 beta 3 release.

Steve

comment:5 by dmorissette, 19 years ago

Cc: dgadoury@… added
Milestone: 4.6 release

comment:6 by sdlime, 19 years ago

Status: newassigned
I dunno guys, the only changes between version 4.2 and 4.6 were related to
changing the form of comments. There are no other changes to that source. From
4.2 on I can find no evidence of DD ever being supported. The label formatting
is consistent all the way back to 4.0.

I did make a small change in the default formating switching from %5.2f to
%5.2g. That should take care of trailing zeros with decimal output, although I'm
not sure if this is a good idea or not.

I also then added an explicit DD label format that just shows the degrees.

I've not tested either of these mods (other than to make sure they compile), so
if you guys would give them a spin and report back I'd appreciate it.

Steve

comment:7 by kenlord@…, 19 years ago

Thanks for looking into it Steve,

I wont be able to test it on my system for some time, but I'm excited to see 
how it works and will try it as soon as I possible.

I first noticed the problem when I migrated from 4.2 to 4.4, and immediately 
the undocumented value of DD in my mapfiles made my map crash, where it had 
worked fine before.

I assumed it stopped working because it was an undocumented / not fully 
supported feature, and that 4.4 was being more strict about it.  But I dont 
have the programming experience to know how these things are handled.

Cheers,
Ken Lord
Vancouver BC

comment:8 by kenlord@…, 19 years ago

Hi Steve,

I finally had a chance to try out your fix for bug 1256.

The value of DD is now accepted in LABELFORMAT, and does indeed create a grid 
labeled in degrees decimal, with 2 decimal places. But it only works of there 
are no other parameters within the GRID object, leaving no control over the 
appearance of the grid. In my case in a map with roughly 20km2 extents, it 
produced roughly 12 grid lines on each axis, at intervals just under 0.01 
degrees per line ... every few lines the label would skip a number, due to 
rounding I assume.

MININTERVAL, MAXINTERVAL, MIN/MAXARCS, MIN/MAXSUBDIVIDE cause the following 
error to occur:

loadLayer(): Unknown identifier. Parsing error near (MINARCS):(line 1029) 
getString(): Symbol definition error. Parsing error near (DD):(line 1028) 

Thanks,
Ken Lord
Vancouver BC

comment:9 by sdlime, 19 years ago

Strange. My mods only affected labels not grid creation, but busting the 
reader is a possibility. I'll check on it.

Steve

comment:10 by sdlime, 19 years ago

Ken: Can you post a mapfile snippet...

Steve

comment:11 by kenlord@…, 19 years ago

Hi Steve, Here's the grid layer from my mapfile:


LAYER
   NAME "Map_Grid_Geographic"
   METADATA
     "DESCRIPTION" "Grid"
   END
   TYPE LINE
   STATUS ON
   CLASS
     NAME "Geographic Graticule"
     COLOR 200 200 160
     LABEL
       #ANGLE AUTO
       BACKGROUNDCOLOR 140 140 140
       COLOR  220 220 180
       FONT "tahoma"
       TYPE truetype
       SIZE 8
       POSITION cc          
       PARTIALS FALSE
       BUFFER 2
       #OUTLINECOLOR 64 64 64          
     END 
   END
  PROJECTION
      "init=EPSG:4326"
  END
  GRID
    LABELFORMAT DDMMSS
    MININTERVAL 0.0875
    MAXINTERVAL 0.0875
  END
END

To use the DD parameter, I change the LABELFORMAT to DD, and I have to rem out 
the min/maxinterval.  I have tried other values for min/maxinterval, and tried 
to use min/maxarcs and min/maxsubdivide.



comment:12 by sdlime, 19 years ago

Try quoting the DD. The problem is that in the context of the UNITS parameter DD
is a symbol and in the case of a gradient it's a string. So, when parsing
MapServer returns the wrong token type and you get an error. I'll look at the
code to see if I can work around the token issue, but quoting is a reasonable
work-around...

Steve

comment:13 by sdlime, 19 years ago

I think I fixed this. We now explicitly check the token to see if it's "DD" and
set the label format appropriately... Ken, please try if you would.

Steve

comment:14 by kenlord@…, 19 years ago

Hi Steve,

Thanks again for your effort.

I'm using windows binaries so I'm afraid I'll have to wait to try your changes 
until they are part of a new release. Hopefully someone else will be able to 
try it sooner.

However, using MapServer 4.6b2, I tried quoting DD, and the crash no longer 
happens. I can again use the min/max parameters, and those parameters are 
working.

But, the grid labels are no longer numbers, they are now all literally "DD"!

Cheers,
Ken Lord
Vancouver BC

comment:15 by sdlime, 19 years ago

Argh. I'm curious if my last fix worked sounds like you can't test though. I'm 
not a GRID user and don't have any test cases. If you could whip up something 
really simple and post it here that would really help.

Steve

comment:16 by kenlord@…, 19 years ago

Steve,  

Since GRID layers dont require any outside data, just a projection and the 
display parameters, I think my example grid layer in a post above should work 
in any map file of yours, just set the Status to Default to force it on and 
change the Font in the Label block if you don't have 'tahoma' available. 

You may need to find a good zoom distance or play with the min/max interval if 
no grid lines appear on your map. The geographic projection in the layer 
should allow it to work anywhere.

One of these days I'll have to learn how to compile MapServer for windows, so 
I can be of more help.

-Ken

comment:17 by dgadoury@…, 19 years ago

Cc: jmckenna@… added

comment:18 by jmckenna@…, 18 years ago

I just tested LABELFORMAT "DD" with 4.8.0-rc2, and get the same results as Ken
(grid labels are literally "DD").

Steve, in mapgraticule.c on line 139, should:

   else if( strcmp( pInfo->labelformat, "DDMM" )

be replaced with:

   else if( strcmp( pInfo->labelformat, "DD" )

??

(sorry if i am stepping on toes)

comment:19 by sdlime, 18 years ago

Resolution: fixed
Status: assignedclosed
Thanks for the reminder (no toes stepped on, you could fix yourself too). Brent
Fraser sent me this fix at the damn conference but it got lost in the shuffle. I
fixed this in both 4.8 (will be in intitial release) and in CVS HEAD.

Steve
Note: See TracTickets for help on using tickets.