Fix for bug #636 in MapServer export script

Enhanced the text_export.py script.


git-svn-id: http://svn.osgeo.org/qgis/trunk@7429 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
gsherman 2007-11-16 22:51:49 +00:00
parent a5dfe88691
commit 1a9cc04c96
2 changed files with 18 additions and 6 deletions

View File

@ -559,7 +559,11 @@ class Qgis2Map:
for cls in classes:
self.outFile.write(" CLASS\n")
lower = cls.getElementsByTagName('lowervalue')[0].childNodes[0].nodeValue.encode('utf-8')
try:
lower = cls.getElementsByTagName('lowervalue')[0].childNodes[0].nodeValue.encode('utf-8')
except IndexError:
# set to blank in the case where the field used for rendering has no value
lower = ""
# If there's a label use it, otherwise autogenerate one
try:

View File

@ -15,9 +15,17 @@
#***************************************************************************/
# test script to export a sample QGIS project file to mapserver
# Test script to export a sample QGIS project file to mapserver
# No template of header/footer information is included in the map file
# To change units, image type, name, and dimensions, modify the ex.setOptions line
#
import sys
import ms_export
ex = ms_export.Qgis2Map('./test1.qgs', './test1.map')
ex.setOptions( 'Meters', 'JPEG', 'TestMap', '800', '600', '', '', '')
ex.writeMapFile()
if len(sys.argv) == 3:
ex = ms_export.Qgis2Map('/home/gsherman/town_test.qgs', './town_test.map')
ex.setOptions( 'Meters', 'JPEG', 'TestMap', '800', '600', '', '', '')
ex.writeMapFile()
else:
print "Test script to export a QGIS project file to a MapServer map file"
print "Specify the QGIS project file and a file name for the map file to be created:"
print " text_export.py my_qgis_project.qgs my_output_map.map"