fixosm 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +34 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +17 -0
- data/Rakefile +1 -0
- data/bin/fixosm +16 -0
- data/fixosm.gemspec +23 -0
- data/lib/.DS_Store +0 -0
- data/lib/fixosm.rb +5 -0
- data/lib/fixosm/osm_file.rb +37 -0
- data/lib/fixosm/version.rb +3 -0
- metadata +85 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 3f793024e1cc3ff16f837b678880914e6a8f5bab
|
|
4
|
+
data.tar.gz: 113c8f3cb1eb8d11a60aafd1b809b91dbb38062e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f7c7edea08c1052ad379d7e7203e0c322f13782e76d6ffaf965852991cb29db21b1efbcdd4f5e8e5f7e8615383305486ab3865004df620eddf68d309723dee68
|
|
7
|
+
data.tar.gz: 8fd1dc876c1250881dc080fbd9d5525f141ad6e43abe55c233f51f6d18e237acebbe111e088c7c53aadb3b7c0151c1a219a72da070ad8bb5c56ccd85ab2bb88e
|
data/.gitignore
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
/.config
|
|
4
|
+
/coverage/
|
|
5
|
+
/InstalledFiles
|
|
6
|
+
/pkg/
|
|
7
|
+
/spec/reports/
|
|
8
|
+
/test/tmp/
|
|
9
|
+
/test/version_tmp/
|
|
10
|
+
/tmp/
|
|
11
|
+
|
|
12
|
+
## Specific to RubyMotion:
|
|
13
|
+
.dat*
|
|
14
|
+
.repl_history
|
|
15
|
+
build/
|
|
16
|
+
|
|
17
|
+
## Documentation cache and generated files:
|
|
18
|
+
/.yardoc/
|
|
19
|
+
/_yardoc/
|
|
20
|
+
/doc/
|
|
21
|
+
/rdoc/
|
|
22
|
+
|
|
23
|
+
## Environment normalisation:
|
|
24
|
+
/.bundle/
|
|
25
|
+
/lib/bundler/man/
|
|
26
|
+
|
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
29
|
+
# Gemfile.lock
|
|
30
|
+
# .ruby-version
|
|
31
|
+
# .ruby-gemset
|
|
32
|
+
|
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
34
|
+
.rvmrc
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Neon Adventures
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Nicholas Kostelnik
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Fixosm
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
$ gem install fixosm
|
|
6
|
+
|
|
7
|
+
And then execute:
|
|
8
|
+
|
|
9
|
+
$ fixosm [input file] [output file]
|
|
10
|
+
|
|
11
|
+
## Contributing
|
|
12
|
+
|
|
13
|
+
1. Fork it ( http://github.com/<my-github-username>/fixosm/fork )
|
|
14
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
15
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
16
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
17
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/fixosm
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require File.join(File.dirname(__FILE__), *%w[.. lib fixosm osm_file])
|
|
4
|
+
|
|
5
|
+
if ARGV.length < 2 then
|
|
6
|
+
puts "Usage: fixosm [input file] [output file]"
|
|
7
|
+
else
|
|
8
|
+
input_filename = ARGV[0]
|
|
9
|
+
output_filename = ARGV[1]
|
|
10
|
+
print "Processing #{input_filename} to #{output_filename}..."
|
|
11
|
+
osm_file = OSMFile.new
|
|
12
|
+
osm_file.open(input_filename)
|
|
13
|
+
osm_file.fix_and_save(output_filename)
|
|
14
|
+
print "Done!"
|
|
15
|
+
puts
|
|
16
|
+
end
|
data/fixosm.gemspec
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'fixosm/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "fixosm"
|
|
8
|
+
spec.version = Fixosm::VERSION
|
|
9
|
+
spec.authors = ["Nicholas Kostelnik"]
|
|
10
|
+
spec.email = ["nkostelnik@gmail.com"]
|
|
11
|
+
spec.summary = %q{Fix up OpenStreetMap Generated data for libosmscout routing}
|
|
12
|
+
spec.description = %q{Sorts nodes, ways and relations into ascending order for libosmscout}
|
|
13
|
+
spec.homepage = "https://github.com/nkostelnik/fixosm"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
end
|
data/lib/.DS_Store
ADDED
|
Binary file
|
data/lib/fixosm.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'nokogiri'
|
|
2
|
+
|
|
3
|
+
class OSMFile
|
|
4
|
+
def open(input_file_path)
|
|
5
|
+
input_file = File.open(input_file_path)
|
|
6
|
+
@input_doc = Nokogiri::XML(input_file)
|
|
7
|
+
input_file.close
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def sorted_nodes(tagname)
|
|
11
|
+
unsorted_nodes = @input_doc.xpath("//#{tagname}")
|
|
12
|
+
unsorted_nodes.sort_by do |node|
|
|
13
|
+
node.attr("id").to_i
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def fix_and_save(output_file_path)
|
|
18
|
+
output_doc = Nokogiri::XML::Document.new
|
|
19
|
+
osm_element = output_doc.add_child("<osm></osm>")
|
|
20
|
+
|
|
21
|
+
sorted_nodes("node").each do |node|
|
|
22
|
+
osm_element.add_child(node)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
sorted_nodes("way").each do |node|
|
|
26
|
+
osm_element.add_child(node)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
sorted_nodes("relation").each do |node|
|
|
30
|
+
osm_element.add_child(node)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
output_file = File.open(output_file_path, 'w')
|
|
34
|
+
output_file.puts output_doc.to_s
|
|
35
|
+
output_file.close
|
|
36
|
+
end
|
|
37
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fixosm
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Nicholas Kostelnik
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.5'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.5'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
description: Sorts nodes, ways and relations into ascending order for libosmscout
|
|
42
|
+
email:
|
|
43
|
+
- nkostelnik@gmail.com
|
|
44
|
+
executables:
|
|
45
|
+
- fixosm
|
|
46
|
+
extensions: []
|
|
47
|
+
extra_rdoc_files: []
|
|
48
|
+
files:
|
|
49
|
+
- ".gitignore"
|
|
50
|
+
- Gemfile
|
|
51
|
+
- LICENSE
|
|
52
|
+
- LICENSE.txt
|
|
53
|
+
- README.md
|
|
54
|
+
- Rakefile
|
|
55
|
+
- bin/fixosm
|
|
56
|
+
- fixosm.gemspec
|
|
57
|
+
- lib/.DS_Store
|
|
58
|
+
- lib/fixosm.rb
|
|
59
|
+
- lib/fixosm/osm_file.rb
|
|
60
|
+
- lib/fixosm/version.rb
|
|
61
|
+
homepage: https://github.com/nkostelnik/fixosm
|
|
62
|
+
licenses:
|
|
63
|
+
- MIT
|
|
64
|
+
metadata: {}
|
|
65
|
+
post_install_message:
|
|
66
|
+
rdoc_options: []
|
|
67
|
+
require_paths:
|
|
68
|
+
- lib
|
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
|
+
requirements:
|
|
71
|
+
- - ">="
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: '0'
|
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
|
+
requirements:
|
|
76
|
+
- - ">="
|
|
77
|
+
- !ruby/object:Gem::Version
|
|
78
|
+
version: '0'
|
|
79
|
+
requirements: []
|
|
80
|
+
rubyforge_project:
|
|
81
|
+
rubygems_version: 2.2.2
|
|
82
|
+
signing_key:
|
|
83
|
+
specification_version: 4
|
|
84
|
+
summary: Fix up OpenStreetMap Generated data for libosmscout routing
|
|
85
|
+
test_files: []
|