[Imports] utf8 Errors running ogr2osm.py

Toby Murray toby.murray at gmail.com
Sun Mar 4 05:57:39 UTC 2012


Hmm now that you mention it, I ran into this as well when trying to
convert a TIGER shapefile.

I think I fixed it by changing 'latin-1' to 'UTF-8' where it creates
the XMLWriter around line 697. Not sure if that is a good fix or not.
I was just trying to do something quick and wasn't actually going to
import it to OSM.

Toby


On Sat, Mar 3, 2012 at 9:03 AM, Andrew Guertin <andrew.guertin at uvm.edu> wrote:
> 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
>
> _______________________________________________
> Imports mailing list
> Imports at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/imports



More information about the Imports mailing list