tyrasd / osmtogeojson

convert osm to geojson
http://tyrasd.github.io/osmtogeojson/
MIT License
683 stars 112 forks source link

Always raise error "1:1 error Parse error on line 1: " t y p e "" when analysing result with geojsonhint #110

Open clemosm opened 5 years ago

clemosm commented 5 years ago

I wanted to use osmtogeojson in order to upload osm data to mapbox. So I used osmtogeojson, but Mapbox says "Unknown filetype" and when I analyse any result from osmtogeojson with geojsonhint, I always get :

1:1 error Parse error on line 1: " t y p e " ^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'INVALID'

And the data I obtained is : { "type": "FeatureCollection", "features": [ { "type": "Feature", "id": "node/1853272897", "properties": { "timestamp": "2017-03-11T12:50:59Z", "version": "4", "changeset": "46761722", "user": "sbiribizio", "uid": "354284", "name": "Capo Linaro", "natural": "cape", "wikidata": "Q3657144", "wikipedia": "it:Capo Linaro", "id": "node/1853272897" }, "geometry": { "type": "Point", "coordinates": [ 11.8357546, 42.028944 ] } } ] } So I don't know where the problem comes from (I thought of different encodings maybe).

tyrasd commented 4 years ago

Hmm, that's odd. The result looks correct as posted above.

Mapbox says "Unknown filetype"

did you try renaming the file to have .geojson file ending?

different encodings maybe

Maybe. Normally, the result should be in utf-8. can you check if this is actually the case on your end? also: what system do you run?

clemosm commented 4 years ago

I run Windows 10. I guess it's in utf-8 already because Sublime Text correctly display it when I ask "open with encoding.." (I don't know how to check otherwise; and I don't have the files at the moment). I didn't rename anything... I thought of a encoding error within osmtogeojson (like reading and writing with different encodings or a missing character Idk). Hopefully I could finally download my dataset in smaller pieces from overpass-turbo (which also uses osmtogeojson...).