Created
October 13, 2014 15:05
-
-
Save distributedlife/82e923a60f1be2c0fc9b to your computer and use it in GitHub Desktop.
polyline_to_geojson
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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