- 🔄 Interactive Encoding/Decoding: Convert between coordinate pairs and encoded polyline strings instantly
- 🗺️ Visual Map Representation: See your polylines rendered on interactive maps
- 📊 Advanced Comparison: Compare multiple polylines with overlay, side-by-side, and differential analysis
- 📱 Responsive Design: Works on desktop and mobile devices
- 🎨 Style Customization: Adjust colors, line thickness, and styles
- 🔍 Detailed Statistics: View distance, density, and other metrics
- 💾 Export Options: Download coordinates in various formats (GeoJSON, CSV)
- 📋 Code Generation: Export coordinates as code snippets for Swift, Java, JavaScript, and Rust
Visit https://polylinedecoder.online to use the tool without installation.
# Clone the repository
git clone https://github.com/engali94/polyline-decoder.git
cd polyline-decoder
# Install dependencies
npm install
# Start development server
npm run dev
- Node.js 16.x or higher
- npm or yarn
-
Clone the repository:
git clone https://github.com/engali94/polyline-decoder.git cd polyline-decoder
-
Install dependencies:
npm install # or yarn
-
Start the development server:
npm run dev # or yarn dev
-
Open http://localhost:8080 in your browser.
- Enter coordinate pairs in the input box (one pair per line or comma-separated)
- The encoded polyline string will automatically be generated
- Adjust precision using the slider if needed
- Enter or paste the encoded polyline string
- The coordinates will be decoded and displayed on the map
- Use the statistics panel to analyze the path
- Enter your primary polyline
- Enable comparison mode
- Enter your secondary polyline
- Choose from three comparison modes:
- Overlay: Shows both polylines on the same map
- Side by Side: Displays two maps for visual comparison
- Diff: Highlights differences and intersections between paths
This tool implements the Google Polyline Algorithm Format, which works by:
- Converting coordinates to integers (multiplied by a precision factor)
- Computing deltas between consecutive points
- Encoding each value into a series of ASCII characters
You can use the core encoding/decoding functions in your own projects:
import { encode, decode } from './src/utils/polylineEncoder';
// Encode coordinates
const coordinates = [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]];
const encoded = encode(coordinates);
console.log(encoded); // "_p~iF~ps|U_ulLnnqC_mqNvxq`@"
// Decode a polyline
const decoded = decode("_p~iF~ps|U_ulLnnqC_mqNvxq`@");
console.log(decoded); // [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]
- Frontend: React, TypeScript
- UI Components: Shadcn UI, Tailwind CSS
- Map Rendering: MapLibre GL
- State Management: React Hooks
- Building: Vite
Contributions are welcome! Feel free to open issues or submit pull requests to help improve this project.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- MapLibre GL for the powerful mapping capabilities
- Shadcn UI for the beautiful UI components
- All contributors who have helped improve this project
Made with ❤️ for the developer community