File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
python/plugins/mapserver_export Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -589,18 +589,24 @@ def writeMapLayers(self):
589
589
layer_def += " MINSCALE " + minscale + "\n "
590
590
if maxscale > '' :
591
591
layer_def += " MAXSCALE " + maxscale + "\n "
592
-
593
-
594
592
# Check for label field (ie LABELITEM) and label status
595
593
try :
596
- labelOn = lyr .getElementsByTagName ( "label" )[0 ].childNodes [0 ].nodeValue .encode ('utf-8' )
597
- labelField = lyr .getElementsByTagName ("labelfield" )[0 ].childNodes [0 ].nodeValue .encode ('utf-8' )
598
- if labelField != '' and labelField is not None and labelOn == "1" :
594
+ labelElements = lyr .getElementsByTagName ("label" )
595
+ labelOn = '0'
596
+ labelField = None
597
+ # there are actually 3 different label-element in a layer element:
598
+ for element in labelElements :
599
+ labelParent = element .parentNode .localName
600
+ if labelParent == 'maplayer' :
601
+ labelOn = element .childNodes [0 ].nodeValue .encode ('utf-8' )
602
+ if labelParent == 'labelattributes' :
603
+ labelField = element .getAttribute ('fieldname' ).encode ('utf-8' )
604
+ if labelField != '' and labelField is not None and labelOn == "1" and labelOn is not None :
599
605
layer_def += " LABELITEM '" + labelField + "'\n "
600
606
except :
601
607
# no labels
602
608
pass
603
-
609
+
604
610
# write the CLASS section for rendering
605
611
# First see if there is a single symbol renderer
606
612
if lyr .getElementsByTagName ("singlesymbol" ).length > 0 :
You can’t perform that action at this time.
0 commit comments