GeoJSON to CSV converter

Flatten a GeoJSON FeatureCollection into a table: one row per feature, every property as a column, and the geometry as coordinates and WKT. Free, and no account needed.

Drop a GeoJSON file here

Download the sample

Your file stays on your computer: nothing is uploaded.

In short

Convert GeoJSON to CSV online, in your browser

GeoJSON in, a flat table out. The Spatibase GeoJSON to CSV converter turns the features of a GeoJSON file into CSV rows in your web browser. How the table is built:

  • Every property gets a column. All keys from all features, after name, description and folder. A feature without a key leaves its cell empty.
  • The geometry in two forms. latitude and longitude for single points, and a wkt column with the shape of every feature, lines and polygons included.
  • Nothing leaves the browser. UTF-8 with a byte order mark for Excel, files up to 50 MB, no account.
How to

How to convert GeoJSON to CSV

  1. Have the GeoJSON as a file: a .geojson or .json from QGIS, geojson.io, an API or a Spatibase export (Export entries (GeoJSON) in the project menu).
  2. Drop it on the box above, or press Choose a file. The sample turns into 9 rows: 5 places, a walking route and 3 areas.
  3. Look over the list under the map: each feature there is one row of the CSV.
  4. Press Download CSV.
  5. Open it in Excel or Google Sheets, or load it with pandas.read_csv. The wkt column goes straight into PostGIS or BigQuery.
What’s kept

How your GeoJSON is laid out in the CSV

WhatWhat happens
FeaturesOne row each, in file order. A feature without geometry is left out, and the notes count it.
First three columnsname, description and folder, always present. They fill from properties with exactly those keys and stay empty otherwise.
Other propertiesOne column per key, in the order they first appear. A Name or title key gets its own column.
Numbers and true/falseWritten as they are, such as 4.5 and true. The CSV itself has no types; Excel and pandas guess them again.
Nested objects and arraysJSON text in one cell, such as {"k":1} or ["a","b"].
null valuesEmpty cells.
Point coordinateslatitude and longitude columns, latitude first, with the numbers exactly as the file stores them.
Every shapeThe wkt column: POINT, LINESTRING, POLYGON with its holes, the MULTI types and GEOMETRYCOLLECTION. MultiPoints get WKT only, no latitude and longitude.
AltitudeDropped from the WKT, which holds longitude and latitude only.
Properties named latitude, longitude or wktReplaced by the columns the converter computes from the geometry.
Feature idNot written: the columns come from properties only.
Formats

Turning nested GeoJSON into a flat table

GeoJSON is a tree; CSV is a grid. Each feature carries its own set of properties, and one feature may have keys the others lack. A CSV needs the same columns on every row.

The converter flattens it in three moves:

  • Columns from the union of keys. It collects every property key of every feature and gives each one a column. Where a feature lacks a key, its cell stays empty.
  • Structure as text. A value that is itself an object or a list can’t spread over columns without guessing names, so it stays one JSON string you can parse later.
  • Geometry as WKT. Well-Known Text writes any shape on one line, longitude before latitude. The walking route in the sample becomes a single LINESTRING cell with 405 coordinate pairs.

A long cell for a detailed shape. A country border can hold tens of thousands of coordinates, and Excel stops a cell at 32,767 characters. Read such files with pandas, a database or QGIS rather than a spreadsheet.

Do it in code

Convert GeoJSON to CSV on the command line

For points, jq writes the rows in one line. For any shape, GDAL’s ogr2ogr adds a WKT column:

# points: name, latitude, longitude
jq -r '.features[] | [.properties.name, .geometry.coordinates[1], .geometry.coordinates[0]] | @csv' places.geojson > places.csv

# any shape: every property plus a WKT column
ogr2ogr -f CSV places.csv places.geojson -lco GEOMETRY=AS_WKT

In Python, geopandas does it in two lines: gdf = gpd.read_file("places.geojson"), then gdf.assign(wkt=gdf.geometry.to_wkt()).drop(columns="geometry").to_csv("places.csv", index=False).

Nested properties as columns? pandas.json_normalize spreads objects into columns such as address.city, which this page leaves as one JSON cell on purpose.

FAQ

Questions about converting GeoJSON to CSV

How do I open a GeoJSON file in Excel?

Excel has no GeoJSON import. Power Query can read the file as JSON, but you then expand the nested records and coordinate lists by hand. Convert it to CSV here and double-click it instead: each feature is a row with its properties, point coordinates and a WKT column for the shape.

How do I get latitude and longitude out of a GeoJSON file?

For points, this converter writes them in two columns, latitude first, the way most people write coordinates. In the GeoJSON itself they are stored the other way round, longitude first. Lines and polygons have many coordinates, so their shape goes into the wkt column instead.

Can I split nested GeoJSON properties into separate columns?

Not on this page: an object or a list is written as JSON text in one cell, so no data is lost and no column names are guessed. To spread them out, read the GeoJSON with pandas and use json_normalize, or use jq to pick the fields you want.

How do I load the wkt column into PostGIS or BigQuery?

In PostGIS, import the CSV into a table and run ST_GeomFromText(wkt, 4326) to make a geometry column. In BigQuery, load it as a table and use ST_GEOGFROMTEXT(wkt). The coordinates are WGS 84 longitude and latitude, the SRID 4326 those functions expect.

Can I turn the CSV back into GeoJSON?

For points, yes: the CSV to GeoJSON tool on this site reads the latitude and longitude columns. Lines and polygons have only WKT, which that tool doesn’t read, so use QGIS (Add Delimited Text Layer with WKT geometry) or ogr2ogr for them.

Is my GeoJSON uploaded when I convert it to CSV?

No. The table is built in your browser from the file on your computer, and Spatibase never sees it. The only thing loaded from the internet is the background map.

Moving the places into Spatibase? Read how to import your data. Need another pair of formats? The GIS file converter converts between all of them.

Talk to us

Not sure it’s a fit? Let’s find out

Tell us about your use case and what you need, from data model to security and deployment. In 30 minutes we’ll look at it together and tell you honestly if we can help.

Or write to hello@spatibase.com.