Skip to content

Commit

Permalink
Fix for bug #636 in MapServer export script
Browse files Browse the repository at this point in the history
Enhanced the text_export.py script.


git-svn-id: http://svn.osgeo.org/qgis/trunk@7429 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
gsherman committed Nov 16, 2007
1 parent a5dfe88 commit 1a9cc04
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
6 changes: 5 additions & 1 deletion tools/mapserver_export/ms_export.py
Expand Up @@ -559,7 +559,11 @@ def uniqueRenderer(self, layerNode, symbolNode):
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:
Expand Down
18 changes: 13 additions & 5 deletions tools/mapserver_export/test_export.py
Expand Up @@ -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"

0 comments on commit 1a9cc04

Please sign in to comment.