FieldTerrain

Your terrain API to reliably retrieve the slope and direction of a field and render a snippet of the underlying srtm heightmap using different methods.

About

This service provides simple API endpoints for accessing tile data and calculating field slopes.

The API is designed to be lightweight and easy to integrate. No client library is required.

Interactive documentation: /docs

Terrain Window API

Retrieve a rectangular window of terrain data using geographic coordinates. The requested area is defined by a longitude and latitude bounding box. The response format can be selected using the format parameter. A maximum window size is enforced to ensure efficient responses.

GET /api/terrain/window

Example request


GET /api/terrain/window?
    min_lon=8.50&
    min_lat=52.00&
    max_lon=8.60&
    max_lat=52.10&
    format=shaded_contours&
    token=YOUR_API_KEY

Coordinates are specified as decimal degrees using the WGS84 coordinate system. The format parameter specifies the output representation and can be one of:

The requested window must not exceed the maximum supported size.

Example response

The endpoint returns an image representation of the requested terrain window.

Example terrain window

Tile API

Retrieve tile information using geographic coordinates.

GET /api/tiles/shaded_contour/

Example request


GET /api/tiles/shaded_contour/tile?x=10&y=20&z=5&token=YOUR_API_KEY

Example response

The endpoint returns a JPG image.

Example heightmap tile

Field Slope API

Retrieve slope information for a geographic location.

GET /api/point_slope

Example request


GET /api/point_slope?
    longitude=8.5510&
    latitude=52.0302&
    token=YOUR_API_KEY

Example response


{
    "slope": 0.05,
    "slope_direction": "north_east"
}

Example response

The slope_direction field describes the direction of the slope and is one of the following values:

north, north_north_east, north_east, east_north_east, east, east_south_east, south_east, south_south_east, south, south_south_west, south_west, west_south_west, west, west_north_west, north_west, north_north_west, or no_slope.



{
    "slope": 0.05,
    "slope_direction": "north_east"
}

Code Examples

Local testing (localhost:8003)

curl


curl --noproxy "*" "http://localhost:8003/api/point_slope?longitude=8.5510&latitude=52.0302&token=YOUR_API_KEY"

Python


import requests

r = requests.get(
    "http://localhost:8003/api/point_slope",
    params={
        "longitude": 8.5510,
        "latitude": 52.0302,
        "token": "YOUR_API_KEY"
    },
    proxies={
        "http": None,
        "https": None
    }
)

print(r.json())

Production API (apistack.eu)

curl


curl "https://apistack.eu/api/point_slope?longitude=8.5510&latitude=52.0302&token=YOUR_API_KEY"

Python


import requests

r = requests.get(
    "https://apistack.eu/api/point_slope",
    params={
        "longitude": 8.5510,
        "latitude": 52.0302,
        "token": "YOUR_API_KEY"
    }
)

print(r.json())

API Key

An API key is required to access this service. Generate your personal API key to start using the API.

API Key

Enter your email address to request an API key.