Convert OSM to CSV

What an OSM to CSV converter keeps, flattens or drops, how to check the output, and when a geometry-aware format is the better choice.

Converting OpenStreetMap (OSM) data to CSV turns a linked, tag-based map database into a flat table. That is useful for spreadsheets, quick counts and simple point lists. It also loses structure, so whether a converter fits your task depends on what you need the table to do. This review explains what the conversion changes, where meaning gets lost, and how to check the result before relying on it.

Evidence note: no tested measurements, benchmarks, prices or tool-specific results were supplied for this article. The guidance below relies on the documented structure of OSM data and the CSV format. It does not report hands-on testing of any particular converter.

Is an OSM to CSV conversion suitable for your use?

Recommendation: CSV is a good fit when you want points of interest with a known, limited set of attributes. Examples include every café in a town with its name, coordinates and opening hours, or a count of features by tag. The main benefit is that almost any spreadsheet, database or scripting language can read the result without GIS software.

The main tradeoff is that CSV has one row per record and a fixed set of columns, while OSM features carry an open-ended set of tags and can reference each other. Something has to give: either you choose which tags become columns and drop the rest, or you pack all tags into one column that is harder to work with.

Keep the data in a geometry-aware format, either the original OSM file or a format such as GeoJSON or GeoPackage, when you need any of the following:

  • Lines and polygons such as roads, rivers, building outlines or boundaries, rather than single points
  • Relations such as bus routes, multipolygons with holes, or turn restrictions
  • Network topology for routing, where shared nodes connect ways
  • The full, unpredictable set of tags on every feature
  • A dataset you plan to edit and upload back to OpenStreetMap

What the conversion actually changes

Some terms around this kind of tool are ambiguous. Here, 'convert' means a structural change to the stored data, not a visual effect. It is not text reversal, mirrored lettering or a decorative 'font'. CSV stores characters only and has no styling. The '.osm' extension almost always refers to OpenStreetMap data. If your file came from other software that uses the same extension, check its origin before choosing a converter.

OSM data is usually distributed in one of two forms. The first is '.osm', an XML text format. The second is '.osm.pbf', a compact binary format used for large extracts. Both describe three element types:

  • Nodes: points with an ID, latitude and longitude, plus optional tags
  • Ways: ordered lists of node IDs that form lines or closed shapes; a way has no coordinates of its own
  • Relations: groups of nodes, ways or other relations, each member with an optional role

Tags are free-form key and value pairs, such as amenity=cafe or name=Main Street. Elements can also carry metadata such as version, timestamp, changeset and contributor username.

A converter flattens this structure in four ways.

  • Element selection: many converters output only nodes, or only elements matching a filter.
  • Tag-to-column mapping: chosen tag keys become columns. Unmapped tags are dropped or packed into a catch-all column.
  • Geometry handling: points become latitude and longitude columns. For ways and relations, the converter must look up member nodes to build coordinates. It then writes a single representative point, a text geometry such as WKT, or nothing at all.
  • Text encoding and escaping: values are written as text, usually UTF-8. Fields that contain the delimiter, quotes or line breaks need quoting.

Below is an illustrative example with invented values. A single node in OSM XML:

<node id="1001" lat="40.7480" lon="-73.9850">
  <tag k="amenity" v="cafe"/>
  <tag k="name" v="Corner Café, Midtown"/>
  <tag k="cuisine" v="coffee_shop;sandwich"/>
</node>

Here is the same node as a CSV row with a header, using the selected columns id, lat, lon, amenity, name and cuisine:

id,lat,lon,amenity,name,cuisine
1001,40.7480,-73.9850,cafe,"Corner Café, Midtown",coffee_shop;sandwich

Several details in this example matter:

  • The name contains a comma, so the field must be wrapped in double quotes. Otherwise the row splits into an extra column.
  • The semicolon in the cuisine value is an OSM convention for multiple values. It survives as plain text but is not split into separate fields.
  • The accented 'é' is unchanged only if the converter and the program opening the file both use the same encoding.
  • Any tag not listed in the header would be missing from this output entirely.

Common ways to produce the CSV

The approaches below are general categories. Option names and defaults change between versions, so confirm them in each tool's current documentation.

Approach | Typical input | What it suits | Main limitation
Overpass API query with CSV output | A live query against OSM data for an area or filter | Small, targeted extracts of tagged features | Not intended for very large areas; you choose columns up front
Command-line converter such as osmconvert with CSV options | A local .osm or .osm.pbf file | Fast flat exports of IDs, coordinates and selected tags | Geometry beyond single coordinates is limited
GDAL/OGR (ogr2ogr) with its OSM driver | A local .osm or .osm.pbf file | Separate layers for points, lines and polygons, with geometry as coordinates or WKT | Tags outside its configuration are packed into one combined column
Web-based upload converters | An uploaded file | Occasional one-off conversions | Behavior and data handling vary; check documented practices rather than assuming

An illustrative Overpass query that asks for CSV output with a header row and comma separator, limited to cafés within a bounding box (south, west, north, east):

[out:csv(::id, ::lat, ::lon, name, amenity; true; ",")];
node["amenity"="cafe"](40.70,-74.02,40.80,-73.93);
out;

Some tools default to a tab separator rather than a comma. In that case the output is actually TSV, even if the file is named .csv. Check the first line of the output before importing it.

Will the CSV stay readable and usable after copying or sharing?

CSV is plain text, so it copies, pastes and searches reliably as long as the delimiter, quoting and encoding are handled consistently. Most problems appear when a spreadsheet interprets the text rather than when the file is moved.

  • Encoding: OSM names use many scripts. A UTF-8 file opened as a legacy encoding shows garbled characters. Some spreadsheet programs need an explicit UTF-8 import step or a byte-order mark.
  • Automatic type conversion: spreadsheets may strip leading zeros from values like postal codes or route references. They may also turn values into dates or round long IDs and coordinates. Importing those columns as text avoids this.
  • Locale settings: in regions that use a comma as the decimal separator, spreadsheets may expect semicolon-delimited files and misread coordinates.
  • Right-to-left text: Arabic or Hebrew names can make a row look reordered in some editors because of bidirectional display. The stored character order is unchanged. Check the raw values before assuming the data is corrupt.
  • Combining marks and emoji: names with combining accents or multi-part emoji should pass through untouched. Problems arise only if a tool re-encodes or truncates the text, so spot-check such values.

Accessibility: a CSV opened as a table in a spreadsheet is generally easier to navigate with assistive technology than raw delimited text, because headers and cells are exposed as a grid. No scoped testing with specific screen readers was supplied, so that is a general expectation rather than a verified result. If people will read the data rather than process it, a properly marked-up table or summary is more dependable than a raw file.

Licensing travels with the data. OpenStreetMap data is published under the Open Database License, which requires attribution to OpenStreetMap contributors. Share-alike terms also apply to derived databases. A CSV extract is still OSM data and needs that attribution when shared.

Contributor metadata: if your export includes usernames or user IDs, decide whether you need them before sharing the file more widely.

How to check a converted file

  • Compare row counts with the number of matching elements you expected, and note which element types were included.
  • Open the raw file in a text editor and confirm the delimiter, header row and quoting of values that contain commas.
  • Search for a few names with accents or non-Latin scripts to confirm the encoding survived.
  • Check that coordinate precision and long ID numbers were not rounded.
  • Confirm how ways and relations were handled: dropped, reduced to one point, or written as geometry text.
  • List the tags you need and verify each one has a column or appears in the combined tag field.

Gaps in this review

No specific converter was tested for this article. There are no measured speeds, file-size limits, accuracy results or privacy assessments of online services. Judge any particular tool by its own documentation and a small trial conversion checked with the steps above.