Resolve locations from text
Extract and resolve location mentions from unstructured text using LLM-based extraction and OpenStreetMap grounding.
GET
/api
Parameters
| Name |
Type |
Required |
Description |
q |
string |
Required |
The text to analyze for location mentions. Must be at least 1 character and no more than 2000 characters. |
model |
string |
Optional |
Ollama model name (e.g., granite3.3:2b, granite4:3b). Defaults to granite3.3:2b. |
Response
Returns a JSON object containing resolved location information.
Response Schema
| Field |
Type |
Description |
doc_id |
string |
Unique identifier for this request. |
model_info |
object |
Metadata about the models and services used (see ModelInfo below). |
results |
array |
List of resolved location mentions (see Result Object below). |
ModelInfo Object
| Field |
Type |
Description |
ollama_model |
string |
Name of the Ollama model used for extraction. |
ollama_base_url |
string |
Base URL of the Ollama service. |
nominatim_base_url |
string |
Base URL of the Nominatim (OpenStreetMap) service. |
config_hash |
string |
Hash of the configuration used for this request. |
Result Object
| Field |
Type |
Description |
mention_id |
string |
Unique identifier for this mention. |
mention |
string |
The extracted place name from text. |
status |
string |
Resolution status: resolved, no_candidate, rejected, invalid_output, or timeout. |
selected |
object | null |
The best matching location candidate (see SelectedCandidate below). Null if status is not resolved. |
candidates |
array |
Ranked list of alternative location candidates (see Candidate below). |
SelectedCandidate Object
| Field |
Type |
Description |
osm_type |
string |
OpenStreetMap type (e.g., relation, way, node). |
osm_id |
integer | string |
OpenStreetMap ID. |
lat |
float | string |
Latitude coordinate. |
lon |
float | string |
Longitude coordinate. |
bbox |
array |
Bounding box as [min_lat, max_lat, min_lon, max_lon]. |
display_name |
string |
Human-readable location name. |
country_code |
string | null |
ISO 3166-1 alpha-2 country code (uppercase). |
confidence |
float | null |
Confidence score for the selection. |
Candidate Object
| Field |
Type |
Description |
rank |
integer |
Ranking position (1 = best). |
osm_type |
string |
OpenStreetMap type. |
osm_id |
integer | string |
OpenStreetMap ID. |
display_name |
string |
Human-readable location name. |
lat |
float | string |
Latitude coordinate. |
lon |
float | string |
Longitude coordinate. |
bbox |
array |
Bounding box coordinates. |
country_code |
string | null |
ISO 3166-1 alpha-2 country code (uppercase). |
category |
string | null |
OSM category (e.g., boundary, place). |
place_rank |
integer | null |
Nominatim place rank. |
importance |
float | null |
Importance score from Nominatim. |
Error Responses
| Status Code |
Description |
400 |
Bad Request - Input text exceeds 2000 characters (input too long). |
500 |
Internal Server Error - Processing failed. Error details in response body. |