To make a great application, we have to use quality ingredients. Placemark needed an encoder and decoder for the Google Encoded Polyline format, so we decided to create a freshened up module for it. It's based off of the Mapbox module (originally from the same author as Placemark), but ready for today's applications. Check out the @placemarkio/polyline module.

What does that mean? Well, a few things. The ergonomics of a good JavaScript module have changed dramatically in the last few years. It's important to support ESM imports, so that you can use JavaScript's native module system and also use systems like Observable with your modules, without a build step. Plus, you'll want TypeScript types, and embedded documentation, so you can be sure that you won't run into TypeErrors in production. It's good to have standard, generated documentation, too. Plus, few - or no - dependencies and a small bundle size.
I'm a big fan of JavaScript and excited about its future, but I won't lie - getting all of this to work is hard. It's really easy to make a module that works when you use it with Node, but doesn't work with a browser or a bundler. Thanks to work on betterknown, check-geojson, and other open source modules published by Placemark, a lot of knowledge and configuration can be reused from one project to another. That way I can publish modules that support Node.js's very new entry points, while also supporting CommonJS and UMD usage.
But enough about JavaScript nitpicks: what @placemarkio/polyline brings is:
- Included, robust TypeScript types with embedded documentation
- ESM & UMD entry points
- Standardized longitude, latitude order in all functions
- Reduced dependencies for a lighter install
- Active maintenance
You can install @placemarkio/polyline, use it to encode and decode Google Encoded Polylines and GeoJSON back and forth. It's what Placemark uses for this conversion, when you import and export features. Check it out!