# LM Geoservices API Base URL: use the public service URL configured in Coolify. This service returns a smooth elevation profile from submitted geo data. It currently supports: - GPX XML with `trkpt`, `rtept`, or `wpt` points containing `lat`, `lon`, and `ele` - GeoJSON `Point`, `LineString`, `MultiLineString`, `Polygon`, `MultiPolygon`, `Feature`, and `FeatureCollection` - Generic JSON arrays such as `[[lon, lat, elevation], ...]` - Generic JSON objects such as `{ "points": [{ "lat": 46.95, "lon": 7.44, "elevation": 540 }] }` Coordinates must contain elevation. GeoJSON uses standard `[longitude, latitude, elevation]` coordinate order. ## Health `GET /health` Response: ```json { "status": "ok" } ``` ## Generate Elevation Profile From JSON `POST /api/elevation-profile` Headers: ```http Content-Type: application/json ``` Request body: ```json { "data": { "type": "LineString", "coordinates": [ [7.44, 46.95, 540], [7.45, 46.951, 560], [7.46, 46.952, 545] ] }, "outputPoints": 1000, "prominence": 20, "peakDistance": 50, "sampleStep": 30, "sigma": 1.5, "smoothingFactor": 15 } ``` `data` may also be a GPX string: ```json { "data": "540560" } ``` ## Generate Elevation Profile From File Upload `POST /api/elevation-profile/upload` Use `multipart/form-data`. Fields: - `file`: GPX, GeoJSON, or JSON file - `outputPoints`: optional, default `1000`, allowed range `2..10000` - `prominence`: optional, default `20` - `peakDistance`: optional, default `50` - `sampleStep`: optional, default `30` - `sigma`: optional, default `1.5` - `smoothingFactor`: optional, default `15` cURL: ```bash curl -sS https://coolify.apps2.livemotion.ch/api/elevation-profile/upload \ -F file=@route.gpx \ -F outputPoints=800 ``` ## Response Success response: ```json { "metadata": { "totalDistanceKm": 2.153, "minElevationM": 540.0, "maxElevationM": 612.3, "elevationGainM": 140.0, "elevationLossM": 68.0, "peaksPreserved": 2, "valleysPreserved": 1, "originalPoints": 492, "keyPoints": 28, "outputPoints": 1000 }, "points": [ { "x": 0.0, "y": 540.12 }, { "x": 0.002, "y": 540.44 } ] } ``` `points` is ordered by distance. `x` is cumulative distance along the submitted track in kilometers. `y` is the smoothed elevation in meters. ## Errors Invalid or unsupported payloads return HTTP `400`: ```json { "detail": "At least two points with latitude, longitude, and elevation are required." } ``` ## Notes For Agents - Prefer `POST /api/elevation-profile` when you already have geo data in memory. - Prefer `POST /api/elevation-profile/upload` for local files. - Always send elevation values. If the source data has only latitude and longitude, enrich it before calling this service. - Use the response `metadata` for summaries and `points` for drawing charts or animations. - API and browser UI point output use `{ "x": distanceKm, "y": elevationM }`.