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
def convert_to_wkt_string geometry | |
if geometry['type'] == "Polygon" | |
wkt_string [geometry["coordinates"]] | |
else | |
wkt_string geometry["coordinates"] | |
end | |
end | |
def wkt_string coordinates | |
"MULTIPOLYGON #{format_outer_polygons coordinates}" |
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
test = [[[-70, 30],[-71, 31]],[[0,0],[-180,90],[-179,75]]]=> [[[-70, 30], [-71, 31]], [[0, 0], [-180, 90], [-179, 75]]] | |
converted = "MULTIPOLYGON ((#{test.map { |coord| "(#{coord.map { |pair| pair.join(" ") }.join ", "})" }.join ", "}))" |
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
#!/usr/bin/env ruby | |
require 'optparse' | |
def run_cmd(text,command) | |
start_time = Time.now | |
puts "-- Starting #{text} at #{start_time.strftime '%I:%M:%S %b %d, %Y'}" | |
result = system command | |
end_time = Time.now |