[OSM-dev] OSM POLY export plugin patch

Martijn van Exel m at rtijn.org
Mon Nov 21 06:09:25 GMT 2011


Hi,

I've been using the OSM Export POLY plugin for Quantum GIS to, well,
generate POLY files. There's a few quirks I encountered, let me share
the patch I did to make the thing play a little nicer. In
polygenerator.py, the part where the base string for the filename is
taken from the selected String field bugged me because 1) it generates
filename strings with slashes and spaces in them which is undesirable
for obvious reasons, and 2) unicode characters in field values made
the thing croak. To fix these quirks, I adapted that part (around line
78) as follows:

       filename =
unicode(attr.toString()).encode('ascii','ignore').replace('/','_').replace('
','_')

       fileHandle = open (str(adir) + "/" + filename + '.poly', 'w')

       fileHandle.write(filename + "\n")


Hope it helps someone - I couldn't find a repo for the source or I'd
have submitted a proper patch there.
-- 
martijn van exel
geospatial omnivore
1109 1st ave #2
salt lake city, ut 84103
801-550-5815
http://oegeo.wordpress.com



More information about the dev mailing list