Mobile apps

What is a polyline on a map?

A polyline is a sequence of latitude-longitude points joined by straight segments and drawn as a line on a map. Routes, driver trails, service boundaries and delivery paths are all displayed this way.

Encoded polylines

A route can have thousands of points. Routing APIs often return them in a compact encoded string that the app decodes, so responses stay small. Google's encoded polyline algorithm is the most common format, and GeoJSON LineString is another.

Making them look right

  • Simplify points when zoomed out; thousands of vertices slow older phones.
  • Snap GPS trails to roads (map matching), otherwise the line zigzags with signal noise.
  • Use dashed or lighter lines for the part already traveled.
  • Keep the line width and color readable on both light and dark maps.

A polygon is a closed polyline used for areas like service zones or geofences. Storing them as GeoJSON in the database makes them reusable across the web console and the mobile app.

Questions, answered

The route is the plan; the polyline is the drawing of its shape.

Raw GPS points contain noise; filtering and road snapping smooth them.

By the Stegnor team · Updated