Skip to content
Permalink
Browse files

fix for #2726 labels no labels in mapserverexport

git-svn-id: http://svn.osgeo.org/qgis/trunk@13708 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rduivenvoorde
rduivenvoorde committed Jun 11, 2010
1 parent 1e670ff commit ac2526b123f4a8829f6aa39facefe5a9cae64985
Showing with 12 additions and 6 deletions.
  1. +12 −6 python/plugins/mapserver_export/ms_export.py
@@ -589,18 +589,24 @@ def writeMapLayers(self):
layer_def += " MINSCALE " + minscale + "\n"
if maxscale > '':
layer_def += " MAXSCALE " + maxscale + "\n"


# Check for label field (ie LABELITEM) and label status
try:
labelOn = lyr.getElementsByTagName( "label")[0].childNodes[0].nodeValue.encode('utf-8')
labelField = lyr.getElementsByTagName("labelfield")[0].childNodes[0].nodeValue.encode('utf-8')
if labelField != '' and labelField is not None and labelOn == "1":
labelElements = lyr.getElementsByTagName("label")
labelOn = '0'
labelField = None
# there are actually 3 different label-element in a layer element:
for element in labelElements:
labelParent = element.parentNode.localName
if labelParent == 'maplayer':
labelOn = element.childNodes[0].nodeValue.encode('utf-8')
if labelParent == 'labelattributes':
labelField = element.getAttribute('fieldname').encode('utf-8')
if labelField != '' and labelField is not None and labelOn == "1" and labelOn is not None:
layer_def += " LABELITEM '" + labelField + "'\n"
except:
# no labels
pass

# write the CLASS section for rendering
# First see if there is a single symbol renderer
if lyr.getElementsByTagName("singlesymbol").length > 0:

0 comments on commit ac2526b

Please sign in to comment.
You can’t perform that action at this time.