0

I am using the following sequence of commands to extract some data from open street map to import to Postgres:

osmconvert -b="-7.57216793459,49.959999905,1.68153079591,58.6350001085" -o=/data/UK.poi.osm /data/europe-latest.osm.pbf

osmfilter /data/UK.poi.osm \
    --keep="highway=bus_stop amenity=clinic =dentist =hospital =doctors =place_of_worship =bar =pub =restaurant =cafe =school =university =pharmacy =cinema =nightclub shop=convenience =supermarket =parking_space =parking =retailaddr building=hotel railway=station addr:housenumber= addr:housename= addr:flats= addr:street= addr:place= addr:city= addr:postcode= url= phone= description=" \
    --drop-relations --drop-author --drop-version > /data/UK_filtered.poi.osm

osmconvert --all-to-nodes --csv="@id @lon @lat amenity name building highway railway url phone description addr:housenumber addr:housename addr:flats addr:street addr:place addr:city addr:postcode" --csv-headline --csv-separator=',' -o=/data/UK.poi.csv /data/UK_filtered.poi.osm

What I get back is a list of empty rows like:

5710782475,-6.0900342,54.4808682,,,,,,,,,,,,,,,

and also misformed lines like:

1000000100018169,-4.6536670,54.0737920,,Radcliffes,yes,,,,+44 1624 822271,"Craft butcher  deli & fishmonger,6,,,Malew Street,,,

where there is a missing double quotes at the end, invalidating the csv.

How can I fix these issues?

1 Answer 1

2
5710782475,-6.0900342,54.4808682,,,,,,,,,,,,,,,

is correct. Node 5710782475 is part of a way tagged as amenity=parking and this tag is part of your filter expression. Since it is part of this way it has no tags itself.

1000000100018169,-4.6536670,54.0737920,,Radcliffes,yes,,,,+44 1624 822271,"Craft butcher  deli & fishmonger,6,,,Malew Street,,,

is also correct, somehow. Way 100018169 is/was really tagged as description="Craft butcher, deli & fishmonger. So the missing double quotes comes directly from OSM data, not osmfilter. I've fixed the data by removing the double quotes in this particular case. But I agree that it should be the task of osmfilter to correct such entries in order to produce valid CSV.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.