NextBillion.ai

Polyline Decoder / About

Powered by NextBillion.ai APIs

About NextBillion.ai Polyline Decoder

Decode polyline strings and GeoJSON LineStrings into readable coordinates and interactive map visualizations.

What is a Polyline Decoder?

The Polyline Decoder is an essential tool that converts encoded polyline strings and GeoJSON LineStrings back into readable geographic coordinates. It supports both Google's polyline encoding format and GeoJSON LineString format, making it versatile for various mapping and routing applications.

Whether you're working with data from NextBillion.ai APIs, Google Maps, or other mapping services, this tool helps you visualize and understand the geographic paths represented by encoded strings.

Benefits of Polyline Decoding

Visualize Routes

Transform encoded strings into visual map representations to understand geographic paths and route quality.

Debug API Responses

Quickly decode and verify route data returned by mapping APIs to ensure accuracy and troubleshoot issues.

Format Conversion

Convert between different coordinate formats and extract readable data from compressed polyline strings.

Supported Input Formats

Encoded Polylines

Decode polylines encoded using Google's polyline encoding algorithm. These are commonly returned by the NextBillion.ai Directions API and other routing services.

Example: _p~iF~ps|U_ulLnnqC_mqNvxq`@

To get encoded polylines from NextBillion.ai Routes API, set polylineEncoding to ENCODED_POLYLINE

GeoJSON LineString

Decode GeoJSON LineString coordinate arrays. These provide higher precision and are commonly used in modern mapping applications.

Example: [[-74.006, 40.7128], [-71.0589, 42.3601]]

To get GeoJSON coordinates from NextBillion.ai Routes API, set polylineEncoding to GEO_JSON_LINESTRING

Key Features

Dual Format Support

Decode both encoded polylines and GeoJSON LineString coordinates

Automatic Unescaping

Built-in handling of escaped characters from JSON responses

Interactive Map Display

Visual representation of decoded paths on an interactive map

Flexible Input

Support for various coordinate formats and automatic parsing

How Polyline Decoding Works

The decoding process reverses the polyline encoding algorithm:

  1. Parse the encoded string character by character
  2. Convert ASCII characters back to binary values
  3. Reconstruct the delta-encoded coordinate differences
  4. Apply the differences to get absolute coordinates
  5. Scale coordinates back to decimal degrees (รท 10^5)

Character Escaping:

The tool automatically handles escaped characters (like \") that appear in JSON responses from APIs, so you can paste the raw response directly without manual processing.

Common Use Cases

API Response Analysis

Visualize and understand route data returned by mapping APIs

Route Debugging

Debug routing issues by visualizing the actual paths on a map

Data Conversion

Convert between different coordinate formats for various applications

Quality Assurance

Verify that encoded routes match expected geographic paths

NextBillion.ai API Integration

This tool is designed to work seamlessly with NextBillion.ai's routing and mapping APIs:

Directions API

Decode polylines returned by the Directions API to visualize calculated routes

Routes API

Handle both encoded polylines and GeoJSON formats from the Routes API responses

Optimization API

Visualize optimized routes and verify the quality of route optimization results

Getting Started

Ready to start decoding polylines? Here's how:

  1. Choose between "Encoded polyline" or "GeoJSON Linestring" tab based on your data format
  2. Paste your polyline string or coordinate array into the input field
  3. Enable "Unescape \" if your data comes from a JSON response
  4. View the decoded coordinates and interactive map visualization

Part of the NextBillion.ai Tools Suite - Empowering developers with powerful mapping and routing utilities