Last active
August 29, 2015 13:57
-
-
Save venj/9909778 to your computer and use it in GitHub Desktop.
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 | |
# encoding = UTF-8 | |
# 模拟导航数据转换GPS坐标算法 | |
# 接受一个参数,指定模拟导航数据文件的名字 | |
path = ARGV[0] | |
open("result.txt", "w+") do |f| | |
open(path).each_line do |line| | |
x, y = line.sub("[", "").sub("]", "").split(",").map {|i| | |
tmp = i.to_f / 100 | |
tmp.floor + (tmp - tmp.floor) / 0.6 | |
} | |
f.printf "%.9f,%.9f\n", x, y | |
end | |
end |
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 | |
# encoding = UTF-8 | |
# 由iPhone采集的数据生成安卓用的测试数据 | |
require "fileutils" | |
include FileUtils | |
cd ARGV[0] do | |
Dir["*.txt"].each do |file| | |
filename = File.basename(file, ".txt") | |
open("#{filename}.db", "w+") do |db| | |
open(file, "r+").each_line do |line| | |
parts = line.split(",") | |
db.puts "#{parts[0]},#{parts[1]}" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment