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?