Troubleshooting Common GeoJSON Errors

Fix common GeoJSON validation errors, formatting issues, and compatibility problems with this comprehensive troubleshooting guide.

Quick Validation Check

Before diving into specific errors, validate your GeoJSON using online tools:

1

Invalid JSON Syntax

Common Symptoms:

  • Parser errors or "unexpected token" messages
  • File won't load in mapping applications
  • Validation tools report JSON syntax errors

❌ Incorrect:

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [-122.4194, 37.7749]
  },
  "properties": {
    "name": "San Francisco",
  }  // Trailing comma
}

✅ Correct:

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [-122.4194, 37.7749]
  },
  "properties": {
    "name": "San Francisco"
  }
}

Solutions:

  • • Remove trailing commas
  • • Ensure all strings are in double quotes
  • • Check for missing or extra brackets/braces
  • • Use a JSON validator to identify syntax issues
2

Incorrect Coordinate Order

Common Symptoms:

  • Points appear in wrong locations (often in the ocean)
  • Data appears on the opposite side of the world
  • Coordinates seem "flipped"

Remember: GeoJSON uses [longitude, latitude] order, not [latitude, longitude]!

❌ Incorrect (lat, lon):

"coordinates": [37.7749, -122.4194]

✅ Correct (lon, lat):

"coordinates": [-122.4194, 37.7749]
3

Invalid Geometry Types

Valid GeoJSON Geometry Types:

  • Point
  • LineString
  • Polygon
  • MultiPoint
  • MultiLineString
  • MultiPolygon
  • GeometryCollection

Common Mistakes:

  • • Using "Line" instead of "LineString"
  • • Using "Circle" (not supported in GeoJSON)
  • • Misspelling geometry types
  • • Using custom geometry types
4

Unclosed Polygon Rings

Rule:

Polygon rings must be closed - the first and last coordinates must be identical.

❌ Unclosed:

"coordinates": [[
  [-122.4, 37.8],
  [-122.4, 37.7],
  [-122.3, 37.7],
  [-122.3, 37.8]
  // Missing closing point
]]

✅ Closed:

"coordinates": [[
  [-122.4, 37.8],
  [-122.4, 37.7],
  [-122.3, 37.7],
  [-122.3, 37.8],
  [-122.4, 37.8]
  // Closes the ring
]]
5

Missing Required Properties

Required Properties:

  • "type" - Must be present in all GeoJSON objects
  • "coordinates" - Required for geometry objects
  • "geometry" and "properties" - Required for Feature objects

Quick Fix:

Always include a "properties" object, even if empty: "properties": {}

Prevention Tips

Best Practices:

  • • Use GeoJSON validation tools regularly
  • • Test with small datasets first
  • • Keep coordinate order consistent
  • • Document your coordinate system

Helpful Tools:

  • • GeoJSONLint for validation
  • • GeoJSON.io for visualization
  • • QGIS for complex validation
  • • JSON formatters for syntax

Need to Fix Your GeoJSON?

Convert your data to GeoJSON with our validator that catches common errors automatically.

Convert & Validate