[Imports] utf8 Errors running ogr2osm.py

Andrew Guertin andrew.guertin at uvm.edu
Sat Mar 3 15:03:07 UTC 2012


On 03/02/2012 07:42 PM, Clifford Snow wrote:
> I am having troubles running ogr2osm.py.  I get the following error
> running ~/bin/ogr2osm/ogr2osm.py tl_2011_04019_roads.shx
> Traceback (most recent call last):
>    File "ogr2osm/ogr2osm.py", line 741, in<module>
>      w.element("tag", k=tagKey.decode("utf-8"), v=tagValue.decode("utf-8"))
>    File "/usr/lib64/python2.7/encodings/utf_8.py", line 16, in decode
>      return codecs.utf_8_decode(input, errors, True)
> UnicodeDecodeError: 'utf8' codec can't decode byte 0xed in position 1:
> invalid continuation byte

This looks like the data has some text that's non-ascii, non-utf-8 text, and 
it's trying to be decoded as utf-8.

A potential workaround would be to modify ogr2osm to decode in whatever the 
correct character set is for the file (probably ISO 8859-1/windows-1252).

> ogr2osm does produce output.  But JSOM gives the following error when
> attempting to load the output file:

That makes sense. The error occurs during XML output, so anything output before 
the error is still there. But the file is incomplete, therefore missing end 
tags, therefore invalid XML, and josm complains.

--Andrew



More information about the Imports mailing list