Bug report #814

attribute reference in mapfiles are exported with index instead of fieldnames

Added by Jürgen Fischer almost 17 years ago. Updated almost 17 years ago.

Status:Closed
Priority:Low
Assignee:Jürgen Fischer
Category:-
Affected QGIS version: Regression?:No
Operating System:All Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:10873

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.

Associated revisions

Revision f0f9bd12
Added by Jürgen Fischer almost 17 years ago

only store name of layerfield if it's actually set, fixes #814

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7453 c8812cc2-4d05-0410-92ff-de0c093fc19c

Revision 415646af
Added by Jürgen Fischer almost 17 years ago

only store name of layerfield if it's actually set, fixes #814

git-svn-id: http://svn.osgeo.org/qgis/trunk@7453 c8812cc2-4d05-0410-92ff-de0c093fc19c

History

#1 Updated by Gary Sherman almost 17 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.

#2 Updated by Jürgen Fischer almost 17 years ago

  • Status changed from Open to In Progress

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.

#3 Updated by Jürgen Fischer almost 17 years ago

  • Status changed from In Progress to Closed
  • Resolution set to fixed

fixed in 2bec93ed (SVN r7449), but the project needs to be resaved before it'll work.

#4 Updated by Gary Sherman almost 17 years ago

  • Status changed from Closed to Feedback
  • Resolution deleted (fixed)

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.

#5 Updated by Jürgen Fischer almost 17 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 415646af (SVN r7454), although the mapserver export doesn't set empty LABELITEMs anyway.

#6 Updated by Jürgen Fischer almost 17 years ago

  • Resolution set to fixed
  • Status changed from Feedback to Closed

Also available in: Atom PDF