Staaarter

CSV to GeoJSON Converter

Detects latitude/longitude columns by header name (lat/latitude, lon/lng/longitude) and converts each row into a GeoJSON Point Feature, with every other column becoming that feature's properties - ready to drop into any GeoJSON-consuming map. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
conversiongeospatial

Overview

Introduction

Location data often starts life as a plain CSV export (a spreadsheet of addresses, sensor readings, or store locations with latitude and longitude columns), but most mapping libraries and GIS tools expect GeoJSON instead. This tool converts one into the other directly in the browser.

It handles the specific detail that trips up a lot of hand-written GeoJSON: the coordinate array order is longitude first, then latitude, not the more intuitive-sounding "lat, long" most people say out loud.

What Is CSV to GeoJSON Converter?

A CSV-to-GeoJSON converter that looks for a latitude column (named lat or latitude) and a longitude column (named lon, lng, long, or longitude), case-insensitively, and turns every valid data row into a GeoJSON Point Feature.

Every column other than the detected coordinate pair becomes a property on that feature, keyed by its original CSV header name, producing a standard GeoJSON FeatureCollection ready for any map library or GIS tool that consumes GeoJSON.

How CSV to GeoJSON Converter Works

After parsing and rectangularizing the CSV, the header row is scanned (case-insensitively, after trimming whitespace) for an exact match against the known latitude and longitude header name variants. If either is missing, conversion stops with a specific error rather than guessing.

Each data row's detected latitude/longitude values are parsed as numbers; rows where either fails to parse are skipped (and counted) rather than emitted with broken coordinates. Every remaining column on the row becomes a `properties` entry, and the row becomes one `Feature` with `geometry.type: "Point"` and `coordinates: [longitude, latitude]`.

When To Use CSV to GeoJSON Converter

Use it when you have a CSV of point locations (stores, sensors, events, addresses with coordinates already geocoded) and need GeoJSON for a mapping library like Leaflet, Mapbox GL, or a GIS tool.

It's not a geocoder - your CSV needs to already have numeric latitude/longitude columns; use a geocoding service first if you're starting from addresses alone.

Features

Advantages

  • Automatically gets the notoriously easy-to-get-wrong [longitude, latitude] coordinate order correct, avoiding a very common class of mapping bug.
  • Detects coordinate columns from common real-world header name variants (lat/latitude, lon/lng/long/longitude) without requiring exact naming.
  • Preserves every other column as a queryable GeoJSON property, so no data from the original CSV is lost.

Limitations

  • Coordinate columns are detected by header name only - a CSV with unusually-named coordinate columns (e.g. "y_coord"/"x_coord") won't be recognized and needs its headers renamed first.
  • Every property value stays a string (matching CSV's own lack of types), even for what look like numbers or booleans in the source data.
  • Only produces Point features - a CSV has no natural way to express lines or polygons, so this conversion direction is one-way for those richer geometry types.

Examples

A small CSV of store locations

Input

name,lat,lon
Store A,51.5074,-0.1278

Output

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": { "type": "Point", "coordinates": [-0.1278, 51.5074] },
      "properties": { "name": "Store A" }
    }
  ]
}

The "lat"/"lon" columns become the Point's coordinates (longitude first), and the remaining "name" column becomes a property.

Best Practices & Notes

Best Practices

  • Rename ambiguous coordinate column headers (like "y"/"x") to lat/lon before converting, since detection is name-based only.
  • Check the skipped-row count in the result - a non-zero count usually means some rows have blank or non-numeric coordinate values worth double-checking in the source CSV.
  • Validate the resulting GeoJSON in a map preview before relying on it, especially for coordinates near the equator or prime meridian where a sign or order mistake is easy to miss visually.

Developer Notes

Coordinate detection intentionally checks only the header row's exact (trimmed, lowercased) text against a fixed list of known variants, rather than trying to fuzzy-match or infer coordinate columns from value ranges (e.g. "a column with values between -90 and 90 is probably latitude") - that kind of heuristic is exactly the sort of silent-guess behavior this site's tools avoid in favor of explicit, predictable rules.

CSV to GeoJSON Converter Use Cases

  • Converting a spreadsheet export of store, event, or sensor locations into GeoJSON for a map
  • Preparing point data for a GIS tool or mapping library that only accepts GeoJSON input
  • Quickly visualizing CSV location data by feeding the GeoJSON output into any map preview tool

Common Mistakes

  • Assuming this geocodes addresses into coordinates - it doesn't; your CSV needs numeric latitude/longitude columns already present.
  • Hand-checking the output and expecting [latitude, longitude] order - GeoJSON's actual order is [longitude, latitude], which is what this tool (correctly) produces.

Tips

  • If conversion fails with a "couldn't find recognizable columns" error, check your header names against the exact supported list (lat/latitude, lon/lng/long/longitude) - even a slightly different name like "Lat." won't match.
  • Use GeoJSON to CSV Converter to go the other direction if you need to get tabular data back out of a GeoJSON Point FeatureCollection.

References

Frequently Asked Questions