Point Must Be in 'lat, lon' Format
Your data has a geo-coordinate field with a value that Solr cannot understand. This guide shows you exactly what went wrong, why, and how to fix it — even if you've never heard of "latitude" before.
What Happened?
The Error: Point must be in 'lat, lon' or 'x y' format:
You tried to index (add) a document into your Solr index, and one of the fields is a location/geo field — a field that stores a point on a map. But the value you sent was empty, malformed, or in the wrong order, so Solr rejected it.
Think of it like filling in an address form. The form expects a city name, but you left it blank or typed a phone number instead. Solr is saying: "I expected a map coordinate, but what you gave me makes no sense."
What Are Geo Coordinates?
Every place on Earth can be described with two numbers:
For example, New York City is at latitude 40.71, longitude -74.00. In Solr, you write this as: 40.71,-74.00
Common Causes
The geo field was sent with no value at all — an empty string "". This is the most common cause. If a document has no coordinates, don't send the field at all rather than sending it empty.
Many APIs (like GeoJSON) use longitude first, but Solr expects latitude first. If your longitude is over 90, Solr rejects it as an impossible latitude. Swap them!
Things like (40.71, -74.00) with parentheses, or lat:40.71 with labels, or degree symbols like 40.71°N — Solr wants plain numbers only.
Latitude must be between -90 and 90. Longitude must be between -180 and 180. Values like 91.5, -74.00 will be rejected — there's no place on Earth at latitude 91!
The Correct Format
How to Fix It
Step 1 — Find the Bad Document
Look at the error in your Error Audit log or your application logs. The error usually happens during indexing (adding/updating documents). Check which document was being sent when the error occurred and inspect its geo field value.
Step 2 — Fix the Coordinates in Your Data
If the field is empty: Don't send the geo field at all for that document. Remove it from your JSON/XML/CSV before indexing. Example in JSON — just remove the key entirely:
// WRONG — sending an empty geo field { "id": "doc1", "title": "My Store", "location": "" // <-- this causes the error! } // CORRECT — omit the field entirely { "id": "doc1", "title": "My Store" // <-- no "location" field at all }
If the coordinates are reversed: Swap latitude and longitude:
// WRONG — longitude first (GeoJSON order) "location": "-74.0060,40.7128" // CORRECT — latitude first (Solr order) "location": "40.7128,-74.0060"
If you have extra characters: Strip everything except digits, minus signs, periods, and commas:
// WRONG "location": "(40.7128, -74.0060)" "location": "40.7128° N, 74.0060° W" // CORRECT "location": "40.7128,-74.0060"
Step 3 — Re-index the Fixed Document
Send the corrected document to your Opensolr index. The error will be gone.
How to Prevent This
Before sending a document to Solr, check: is the geo field empty? Is latitude between -90 and 90? Is longitude between -180 and 180? If validation fails, skip the geo field for that document.
In your application code, when coordinates are missing, set the field to null or simply omit it from the document. Never send an empty string "" for a geo field.
GeoJSON uses [lon, lat] order. Google Maps uses (lat, lng). Solr uses lat,lon. Always check what order your data source provides and convert accordingly.
Quick Reference
| Item | Details |
|---|---|
| Error Class | InvalidShapeException from org.locationtech.spatial4j |
| When It Happens | During indexing (adding/updating documents with geo fields) |
| Solr Field Types | solr.LatLonPointSpatialField, solr.SpatialRecursivePrefixTreeFieldType, solr.LatLonType |
| Correct Format | lat,lon — e.g., 40.7128,-74.0060 |
| Latitude Range | -90 to +90 |
| Longitude Range | -180 to +180 |
Still Seeing This Error?
Check your Error Audit dashboard or reach out to the Opensolr team.