Opened 17 years ago

Closed 16 years ago

#2311 closed defect (fixed)

OGR:Label* attributes should return default values for objects with no label

Reported by: dmorissette Owned by: aboudreault
Priority: normal Milestone: 5.4 release
Component: OGR Support Version: 5.0
Severity: normal Keywords:
Cc: dmorissette

Description

Jelmer Baas wrote to mapserver-users:

> 
> Thanks for your quick response. I tried to use OGR:LabelText, and it 
> seems to work -- sometimes. For *some* layers I get this following, 
> quite interesting, error:
> 
> msDrawMap(): Image handling error. Failed to draw layer named 'topo'.
> msOGRGetValues(): OGR error. Invalid field index!?!
> 

And I replied...

Jelmer,

I checked in the code, and it seems that you'd get that error if MapServer tries to read one of the OGR:Label* attributes on a feature that does not have a label definition, or in the case of TAB files, on a MapInfo object that is not a TEXT object.

I am realizing just now that this makes it impossible to use OGR:Label* on a .TAB file that has mixed object types. I think it would be possible to make MapServer handle this more gracefully, returning some default values (text="", angle=0 and size=0) in cases where the object is not of the right type.

I filed this an a future enhancement. In the meantime you'll have to make sure the files you use for annotation contain only objects of type TEXT.

Attachments (1)

bug2311.patch (5.0 KB ) - added by aboudreault 16 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by dmorissette, 16 years ago

Milestone: 5.2 release5.4 release

comment:2 by dmorissette, 16 years ago

Cc: dmorissette added
Owner: changed from dmorissette to aboudreault

by aboudreault, 16 years ago

Attachment: bug2311.patch added

comment:3 by aboudreault, 16 years ago

Here's the patch that will make the msOGRGetValues() function return default values if the object type is not TEXT.

comment:4 by dmorissette, 16 years ago

Looks good Alan. Please commit.

comment:5 by aboudreault, 16 years ago

Resolution: fixed
Status: newclosed

Committed in r7989

Note: See TracTickets for help on using tickets.