← Back

ofxGooglePolyline

github.com/paulobarcelos/ofxGooglePolyline · @paulobarcelos
OF 0.12 Releases Utilities

openFrameworks addon for decoding Google encoded polylines into sketch-friendly longitude/latitude coordinates.

3 0 Last commit 4mo ago Created 14y ago

README

ofxGooglePolyline



Tiny openFrameworks addon for decoding strings that use the Google Encoded Polyline Algorithm Format.

This is handy when you are sketching with route data from mapping APIs and want the encoded path back as openFrameworks-friendly coordinates. Points are returned as ofVec2f, with x = longitude and y = latitude, which maps naturally to screen coordinates after projection/scaling.

Usage



std::string encoded = "_p~iF~ps|U_ulLnnqC_mqNvxq@";
std::vector<ofVec2f> points = ofxGooglePolyline::decodePolyline(encoded);

for(const auto& point : points){
    ofLogNotice() << "lng: " << point.x << ", lat: " << point.y;
}


The original pointer-returning
ofxGooglePolyline::decode() function is still available for older projects, but new code should use decodePolyline()` so ownership is clear and nothing leaks.

Compatibility



Tested with openFrameworks 0.12.1 on macOS.

The example includes the standard openFrameworks Makefile flow:

cd example
make Debug
make RunDebug

Get this addon

HTTPS
SSH

Latest release

0.3.0 ofxGooglePolyline 0.3.0 published 4mo ago
Maintenance release for current openFrameworks projects.

  • Adds decodePolyline() as a value-returning API that avoids ownership leaks.
  • Keeps the original pointer-returning decode() wrapper for older sketches.
  • Modernizes the example window setup and Makefile build.
  • Refreshes the README with clearer coordinate-order notes.
Verified with make Debug using openFrameworks 0.12.1 on macOS.