Skip to main content

🌧️ Cropped precision

Each polygon is pre-clipped to the exact circular area you queried β€” no post-processing needed on your side.

⚑ Binary-efficient

Protobuf encoding cuts payload size significantly compared to JSON, making it ideal for mobile and embedded clients.

πŸ—ΊοΈ GeoJSON-ready

Two decode steps are all it takes to go from raw bytes to shapes you can drop straight into geojson.io or Mapbox.

What the endpoint returns

POST /v1/precipitations/geometry responds with a raw binary body (Content-Type: application/x-protobuf). The bytes encode a PrecipitationFeatureCollection message β€” a list of PrecipitationFeature items, each carrying a cropped MultiPolygon geometry and typed precipitation properties.
Do not try to parse the response body as JSON or text. It is a protobuf binary stream and will look like garbage if treated as a string.

Proto schema πŸ“„

Below are the proto message definitions used by iklim.co for this endpoint.
Copy the full geojson.proto file into your project before running the decoder steps below. The protobufjs loader needs the file at runtime.

Decoding & converting to GeoJSON πŸ› οΈ

Why two steps? GeoJSON is a JSON text format (RFC 7946) β€” it has no official protobuf schema. Its coordinates are bare nested arrays ([[lng, lat], ...]), which protobuf cannot represent without a named wrapper message. iklim.co’s binary schema uses typed messages (Coordinate, Ring, PolygonShape, …) optimised for compact encoding, so a structural reshaping step is always required after decoding.
1

Install protobufjs πŸ“¦

2

Fetch the binary response 🌐

Tell fetch to read the response as an ArrayBuffer, then wrap it in a Uint8Array for the proto decoder.
3

Decode the protobuf bytes πŸ”“

Load geojson.proto and decode the bytes into a JavaScript object.
At this point fc looks like:
4

Convert to standard GeoJSON πŸ—ΊοΈ

Transform the decoded object into RFC 7946-compliant GeoJSON.

Field reference πŸ“š

PrecipitationFeature

geometry (MultiPolygon)

properties

IntensityType catalog