Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 committed Jun 11, 2010
1 parent 1e670ff commit ac2526b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions python/plugins/mapserver_export/ms_export.py
Expand Up @@ -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:
Expand Down

0 comments on commit ac2526b

Please sign in to comment.