Skip to content

Instantly share code, notes, and snippets.

@distributedlife
Created October 13, 2014 15:05
Show Gist options
  • Save distributedlife/82e923a60f1be2c0fc9b to your computer and use it in GitHub Desktop.
Save distributedlife/82e923a60f1be2c0fc9b to your computer and use it in GitHub Desktop.
polyline_to_geojson
require 'polylines'
points = Polylines::Decoder.decode_polyline(File.read("data"))
reversed = points.map { |point| [point.last, point.first] }
puts "{\"type\":\"LineString\", \"coordinates\": #{reversed}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment