How to Simplify a Large GeoJSON Polygon or Line

API or service
Geometry Operations API
Task
Detailed geometry + tolerance → smaller GeoJSON
Examples
URL
Difficulty
Beginner
Time
7 min

Simplify a large GeoJSON polygon or line

You have a detailed LineString, Polygon, or MultiPolygon that is expensive to transmit, store, or render. The Geometry Operations API simplify operation removes unnecessary positions while retaining the overall shape.

Task flow: detailed geometry + tolerance → simplified GeoJSON → compare size and accuracy.

Simplification is useful for overview maps and regional analysis. Keep the original geometry for legal boundaries, editing, precise measurements, and high-zoom display; simplification deliberately discards spatial detail.

Choose a safe simplification tolerance

params.tolerance controls how far the simplified geometry may deviate in the input coordinate system. GeoJSON longitude and latitude are decimal degrees, so a tolerance of 0.001 is roughly 111 meters north–south; its east–west distance varies by latitude.

Start with a small tolerance and compare the result against the source at the map zoom where it will be used. Track at least:

  • input and output position counts;
  • encoded file size;
  • visible boundary displacement;
  • whether small holes, narrow corridors, or bends disappeared;
  • whether the output remains valid for later operations.

Set highQuality=true when preserving shape matters more than processing speed. Do not choose one tolerance for every dataset: city blocks, country boundaries, and GPS tracks have different acceptable error.

Simplify the geometry

This example removes three nearly collinear intermediate positions from a six-position line:

POST https://api.geoapify.com/v1/geometry/operation?apiKey=YOUR_API_KEY
Content-Type: application/json
{
  "operation": "simplify",
  "geometry": {
    "type": "LineString",
    "coordinates": [
      [13.38, 52.50],
      [13.39, 52.5001],
      [13.40, 52.50],
      [13.41, 52.5002],
      [13.42, 52.50],
      [13.44, 52.51]
    ]
  },
  "params": {
    "tolerance": 0.001,
    "highQuality": true
  }
}

Reduced response: The API returns the simplified geometry in a GeoJSON Feature.

{
  "type": "geojson",
  "data": {
    "type": "Feature",
    "properties": {},
    "geometry": {
      "type": "LineString",
      "coordinates": [
        [13.38, 52.50],
        [13.42, 52.50],
        [13.44, 52.51]
      ]
    }
  }
}

This input decreases from six positions to three. Always measure the reduction from the actual response; other shapes can retain more or fewer points at the same tolerance.