Opened 16 years ago

Closed 16 years ago

#814 closed defect (fixed)

attribute reference in mapfiles are exported with index instead of fieldnames

Reported by: jef Owned by: jef
Priority: major: does not work as expected Milestone:
Component: MapServer export Version: Trunk
Keywords: Cc:
Must Fix for Release: No Platform: All
Platform Version: Awaiting user input: no

Description

when a qgis project is converted to a mapfile the references to layer attributes are exported as field index instead of field name, eg. LABELITEM 0 instead of the name of the first field. Same applies to CLASSITEMs.

AFAICS this cannot be easily fixed, because the project file doesn't contain information about the attribute names. Maybe that should be changed anyway as the attributes or their order in the table might change, although the references fields still exists.

Change History (6)

comment:1 by gsherman, 16 years ago

This requires a change in the QgsProject code to either:

  1. write a separate xml tag containing the actual field name
  2. eliminate the use of the field index and use the name instead

Item 1 is probably the simplest at present and wouldn't impact existing project read/write routines.

The mapserver exporter currently has no way to open data sets and retrieve the field information, given we are dealing with file-based and PostGIS data stores.

comment:2 by jef, 16 years ago

Owner: changed from nobody to jef
Status: newassigned

This doesn't apply to CLASSITEMs as they are written explictly be name.

I'll add a attribute containing the name of the field to the label tag in vector layers and add support for that in the mapexport.

comment:3 by jef, 16 years ago

Resolution: fixed
Status: assignedclosed

fixed in r7448, but the project needs to be resaved before it'll work.

comment:4 by gsherman, 16 years ago

Resolution: fixed
Status: closedreopened

This doesn't work. The default label text is being written to the XML rather than the name of the label field. I think the changes may need to be made in QgsLabel::writeXML in order to get the correct field name.

comment:5 by jef, 16 years ago

how does the default label text get exported?

AFAICS QgsLabel::labelField(Text) either returns the correct fieldname or an empty string. The empty string case is now covered in r7453, although the mapserver export doesn't set empty LABELITEMs anyway.

comment:6 by jef, 16 years ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.