gcps2tiles 0.0.1
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 +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +21 -0
- data/README.md +148 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/gcps2tiles +22 -0
- data/gcps2tiles.gemspec +31 -0
- data/lib/gcps2tiles.rb +64 -0
- data/lib/gcps2tiles/gcps.rb +79 -0
- data/lib/gcps2tiles/version.rb +3 -0
- data/screenshots/gcps2tiles-20160727.png +0 -0
- metadata +188 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2cbdc4637a2fe89b092590f47cfd8c07d0b04f50
|
4
|
+
data.tar.gz: f7362f8524a8cea6a68733c0508131c08cacdbd5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1bff425158a5c6c7abfb8f78fb5bc1eb560a898e0dd2b502e8380159a9564ad8d9e4585d6200fd8fea876d77c3ead50889b206ceb01fc1a33ef79efc4dd7c856
|
7
|
+
data.tar.gz: 82421768cac62d36fbd293bc63e8e02a2637e0eeb45d9afe8538f9e66d46b385583d0d7154524fc2f404b16fe123897ff88afb5475add505d2d8b5d600b7330d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Masayuki Higashino
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
# gcps2tiles
|
2
|
+
|
3
|
+
A generator of TMS (Tile Map Service) tiles from a image and its GCPs (Ground Control Points).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```bash
|
8
|
+
$ gem install gcps2tiles
|
9
|
+
```
|
10
|
+
|
11
|
+
### Dependencies
|
12
|
+
|
13
|
+
1. `gdal_translate`
|
14
|
+
2. `gdal2tiles.py`
|
15
|
+
|
16
|
+
These command-line tools are executed by `systemu` or `open3` from `gcps2tiles`.
|
17
|
+
|
18
|
+
### Example for Instllation
|
19
|
+
|
20
|
+
* macOS
|
21
|
+
* macPorts
|
22
|
+
* RubyGems
|
23
|
+
|
24
|
+
```bash
|
25
|
+
# for gdal_translate
|
26
|
+
$ sudo port install gdal
|
27
|
+
$ which -a gdal_translate
|
28
|
+
/opt/local/bin/gdal_translate
|
29
|
+
|
30
|
+
# for gdal2tiles.py
|
31
|
+
$ sudo port install py27-gdal
|
32
|
+
$ which /opt/local/share/doc/py27-gdal/examples/scripts/gdal2tiles.py
|
33
|
+
/opt/local/share/doc/py27-gdal/examples/scripts/gdal2tiles.py
|
34
|
+
|
35
|
+
# for gcps2tiles
|
36
|
+
$ sudo port install proj
|
37
|
+
$ gem install proj4rb -- --with-opt-include=/opt/local/include --with-opt-lib=/opt/local/lib
|
38
|
+
$ gem install gcps2tiles
|
39
|
+
$ which gcps2tiles
|
40
|
+
/Users/masayuki/.rbenv/shims/gcps2tiles
|
41
|
+
```
|
42
|
+
|
43
|
+
## Usage
|
44
|
+
|
45
|
+
```bash
|
46
|
+
# run help of gcps2tiles
|
47
|
+
$ gcps2tiles help
|
48
|
+
Commands:
|
49
|
+
gcps2tiles generate --gcps-file-path=GCPS_FILE_PATH --image-file-path=IMAGE_FILE_PATH # generator TMS (Tile Map Service) tiles from a image and its GCPs (Ground Control Points)
|
50
|
+
gcps2tiles help [COMMAND] # Describe available commands or one specific command
|
51
|
+
|
52
|
+
Options:
|
53
|
+
[--gdal-translate-path=GDAL_TRANSLATE_PATH]
|
54
|
+
# Default: gdal_translate
|
55
|
+
[--python-path=PYTHON_PATH]
|
56
|
+
# Default: python
|
57
|
+
[--gdal2tiles-path=GDAL2TILES_PATH]
|
58
|
+
# Default: gdal2tiles.py
|
59
|
+
```
|
60
|
+
|
61
|
+
### Example for Usage
|
62
|
+
|
63
|
+
The command `ls` displays a raster image and its gcps points file. The `txu-oclc-6550386.jpg` is download from http://www.lib.utexas.edu/maps/ams/japan_city_plans/. The image's URL is http://www.lib.utexas.edu/maps/ams/japan_city_plans/txu-oclc-6550386.jpg. The `txu-oclc-6550386.points` is generated from the image by hand work with [QGIS's Georeferencer GDAL Plugin](http://docs.qgis.org/2.0/en/docs/user_manual/plugins/plugins_georeferencer.html).
|
64
|
+
|
65
|
+
```bash
|
66
|
+
$ ls
|
67
|
+
txu-oclc-6550386.jpg txu-oclc-6550386.points
|
68
|
+
```
|
69
|
+
|
70
|
+
The command `cat` displays the content of `txu-oclc-6550386.points`.
|
71
|
+
|
72
|
+
```bash
|
73
|
+
$ cat txu-oclc-6550386.points
|
74
|
+
mapX,mapY,pixelX,pixelY,enable
|
75
|
+
14942011.24356307648122311,4231785.85050928499549627,1933.549259681095009,-1827.33727220956689052,1
|
76
|
+
14942204.06600598804652691,4231988.44545324612408876,2026.88463391136860992,-1723.68220134874627547,1
|
77
|
+
14942476.045682268217206,4231792.49753643479198217,2154.75512528474064311,-1818.79513097949893563,1
|
78
|
+
14940591.59045474231243134,4232046.88148782681673765,1223.80780346820824889,-1725.78961946050026199,1
|
79
|
+
14939983.62762918882071972,4233524.63498547300696373,913.52901740949482701,-991.62939136701231746,1
|
80
|
+
14939850.02285714447498322,4233210.41635492164641619,838.98519306166406295,-1146.04159894466192782,1
|
81
|
+
14938191.42381835728883743,4235546.01964407879859209,0,0,1
|
82
|
+
14948244.77059711329638958,4235127.56189436092972755,5000,0,1
|
83
|
+
14948112.61969627812504768,4227568.21257229428738356,5000,-3841,1
|
84
|
+
14938057.33083977922797203,4227986.65016794484108686,0,-3840.99765173410287389,1
|
85
|
+
```
|
86
|
+
|
87
|
+
The command `gcps2tiles` generates TMS (Tile Map Service) tiles from `txu-oclc-6550386.jpg` and `txu-oclc-6550386.points` into the directory `txu-oclc-6550386`.
|
88
|
+
|
89
|
+
```bash
|
90
|
+
$ gcps2tiles generate --gcps-file-path=txu-oclc-6550386.points --image-file-path=txu-oclc-6550386.jpg --output-dir-path txu-oclc-6550386
|
91
|
+
$ gdal_translate -of VRT -gcp 1933.549259681095 1827.337272209567 14942011.243563076 4231785.850509285 -gcp 2026.8846339113686 1723.6822013487463 14942204.066005988 4231988.445453246 -gcp 2154.7551252847406 1818.795130979499 14942476.045682268 4231792.497536435 -gcp 1223.8078034682082 1725.7896194605003 14940591.590454742 4232046.881487827 -gcp 913.5290174094948 991.6293913670123 14939983.627629189 4233524.634985473 -gcp 838.9851930616641 1146.041598944662 14939850.022857144 4233210.416354922 -gcp 0.0 -0.0 14938191.423818357 4235546.019644079 -gcp 5000.0 -0.0 14948244.770597113 4235127.561894361 -gcp 5000.0 3841.0 14948112.619696278 4227568.212572294 -gcp 0.0 3840.997651734103 14938057.33083978 4227986.650167945 txu-oclc-6550386.jpg /var/folders/cc/470s1lj92dx_7z9ykv36kt0m0000gn/T/txu-oclc-6550386.vrt20160727-40569-n8ta9b
|
92
|
+
$ python gdal2tiles.py --s_srs epsg:3857 /var/folders/cc/470s1lj92dx_7z9ykv36kt0m0000gn/T/txu-oclc-6550386.vrt20160727-40569-n8ta9b
|
93
|
+
python: can't open file 'gdal2tiles.py': [Errno 2] No such file or directory
|
94
|
+
#<Process::Waiter:0x007fed4d896d30 dead>
|
95
|
+
#<Process::Status: pid 40599 exit 2>
|
96
|
+
```
|
97
|
+
|
98
|
+
To remove the error `python: can't open file 'gdal2tiles.py': [Errno 2] No such file or directory`, you can set a path to the command-line tool.
|
99
|
+
|
100
|
+
```bash
|
101
|
+
$ gcps2tiles generate --gcps-file-path=txu-oclc-6550386.points --image-file-path=txu-oclc-6550386.jpg --output-dir-path txu-oclc-6550386 --gdal2tiles-path=/opt/local/share/doc/py27-gdal/examples/scripts/gdal2tiles.py
|
102
|
+
run gdal_translate -of VRT -gcp 1933.549259681095 1827.337272209567 14942011.243563076 4231785.850509285 -gcp 2026.8846339113686 1723.6822013487463 14942204.066005988 4231988.445453246 -gcp 2154.7551252847406 1818.795130979499 14942476.045682268 4231792.497536435 -gcp 1223.8078034682082 1725.7896194605003 14940591.590454742 4232046.881487827 -gcp 913.5290174094948 991.6293913670123 14939983.627629189 4233524.634985473 -gcp 838.9851930616641 1146.041598944662 14939850.022857144 4233210.416354922 -gcp 0.0 -0.0 14938191.423818357 4235546.019644079 -gcp 5000.0 -0.0 14948244.770597113 4235127.561894361 -gcp 5000.0 3841.0 14948112.619696278 4227568.212572294 -gcp 0.0 3840.997651734103 14938057.33083978 4227986.650167945 txu-oclc-6550386.jpg /var/folders/cc/470s1lj92dx_7z9ykv36kt0m0000gn/T/txu-oclc-6550386.vrt20160727-41911-371ieu
|
103
|
+
run python /opt/local/share/doc/py27-gdal/examples/scripts/gdal2tiles.py --s_srs epsg:3857 /var/folders/cc/470s1lj92dx_7z9ykv36kt0m0000gn/T/txu-oclc-6550386.vrt20160727-41911-371ieu txu-oclc-6550386
|
104
|
+
Generating Base Tiles:
|
105
|
+
0...10...20...30...40...50...60...70...80...90...100 - done.
|
106
|
+
Generating Overview Tiles:
|
107
|
+
0...10...20...30...40...50...60...70...80...90...100 - done.
|
108
|
+
```
|
109
|
+
|
110
|
+
Tips: The options for a path to a command-line tool as is follows:
|
111
|
+
|
112
|
+
* `--gdal-translate-path=GDAL_TRANSLATE_PATH]` # Default: gdal_translate
|
113
|
+
* `--gdal2tiles-path=GDAL2TILES_PATH]` # Default: gdal2tiles.py
|
114
|
+
* `--python-path=PYTHON_PATH]` # Default: python
|
115
|
+
|
116
|
+
```bash
|
117
|
+
$ tree txu-oclc-6550386 -L 1
|
118
|
+
txu-oclc-6550386
|
119
|
+
├── 11
|
120
|
+
├── 12
|
121
|
+
├── 13
|
122
|
+
├── 14
|
123
|
+
├── 15
|
124
|
+
├── 16
|
125
|
+
├── googlemaps.html
|
126
|
+
├── openlayers.html
|
127
|
+
└── tilemapresource.xml
|
128
|
+
|
129
|
+
6 directories, 3 files
|
130
|
+
$ du -sh txu-oclc-6550386.jpg
|
131
|
+
4.0M txu-oclc-6550386.jpg
|
132
|
+
$ du -sh txu-oclc-6550386
|
133
|
+
28M txu-oclc-6550386
|
134
|
+
```
|
135
|
+
|
136
|
+
To show TMS tiles which generated by `gdal2tiles.py`.
|
137
|
+
|
138
|
+
```bash
|
139
|
+
$ open txu-oclc-6550386/openlayers.html
|
140
|
+
```
|
141
|
+
|
142
|
+

|
143
|
+
|
144
|
+
## Development
|
145
|
+
|
146
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
147
|
+
|
148
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gcps2tiles"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/gcps2tiles
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'gcps2tiles'
|
4
|
+
require 'thor'
|
5
|
+
|
6
|
+
class CLI < Thor
|
7
|
+
|
8
|
+
class_option :gdal_translate_path, default:'gdal_translate'
|
9
|
+
class_option :python_path, default:'python'
|
10
|
+
class_option :gdal2tiles_path, default:'gdal2tiles.py'
|
11
|
+
|
12
|
+
method_option :image_file_path, required:true
|
13
|
+
method_option :gcps_file_path, required:true
|
14
|
+
method_option :output_dir_path
|
15
|
+
desc 'generate', 'generator TMS (Tile Map Service) tiles from a image and its GCPs (Ground Control Points) '
|
16
|
+
def generate
|
17
|
+
GCPS2TILES.execute(options)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
CLI.start(ARGV)
|
data/gcps2tiles.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gcps2tiles/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'gcps2tiles'
|
8
|
+
spec.version = GCPS2TILES::VERSION
|
9
|
+
spec.authors = ['mh61503891']
|
10
|
+
spec.email = ['mh.on.web@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{A generator of TMS (Tile Map Service) tiles from a image and its GCPs (Ground Control Points).}
|
13
|
+
spec.description = %q{A generator of TMS (Tile Map Service) tiles from a image and its GCPs (Ground Control Points).}
|
14
|
+
spec.homepage = 'https://github.com/mh61503891/gcps2tiles'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency 'proj4rb'
|
23
|
+
spec.add_dependency 'memoizable'
|
24
|
+
spec.add_dependency 'thor'
|
25
|
+
spec.add_dependency 'systemu'
|
26
|
+
spec.add_dependency 'colorize'
|
27
|
+
spec.add_development_dependency 'pry'
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
|
+
end
|
data/lib/gcps2tiles.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'gcps2tiles/version'
|
2
|
+
require 'gcps2tiles/gcps'
|
3
|
+
require 'systemu'
|
4
|
+
require 'colorize'
|
5
|
+
require 'open3'
|
6
|
+
|
7
|
+
module GCPS2TILES
|
8
|
+
|
9
|
+
def self.create_vrt_file(options)
|
10
|
+
gcps = GCPs.new(options['gcps_file_path']).csv.map { |row|
|
11
|
+
[row[:pixelx].to_f, -row[:pixely].to_f, row[:mapx].to_f, row[:mapy].to_f].join(' ')
|
12
|
+
}.map { |gcp|
|
13
|
+
"-gcp #{gcp}"
|
14
|
+
}.join(' ')
|
15
|
+
gdal_translate_path = options['gdal_translate_path']
|
16
|
+
image_file_path = options['image_file_path']
|
17
|
+
vrt_file_path = Tempfile.open(File.basename(image_file_path, File.extname(image_file_path)) + '.vrt'){ |f| f.to_path }
|
18
|
+
program = "#{gdal_translate_path} -of VRT #{gcps} #{image_file_path} #{vrt_file_path}"
|
19
|
+
print 'run '.colorize(:blue)
|
20
|
+
puts program.colorize(:light_blue)
|
21
|
+
status, = systemu(program)
|
22
|
+
return vrt_file_path if status.success?
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.create_tile_files(options)
|
26
|
+
python_path = options['python_path']
|
27
|
+
gdal2tiles_path = options['gdal2tiles_path']
|
28
|
+
output_dir_path = options['output_dir_path']
|
29
|
+
vrt_file_path = create_vrt_file(options)
|
30
|
+
program = "#{python_path} #{gdal2tiles_path} --s_srs epsg:3857 #{vrt_file_path} #{output_dir_path}"
|
31
|
+
print 'run '.colorize(:blue)
|
32
|
+
puts program.colorize(:light_blue)
|
33
|
+
x = Open3.popen3(program) do |i, o, e, w|
|
34
|
+
o.each_char{ |char| print char }
|
35
|
+
e.each_char{ |char| print char }
|
36
|
+
p w
|
37
|
+
end
|
38
|
+
p x.value
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.execute(options)
|
42
|
+
p options
|
43
|
+
# %w(gdal_translate gdalwarp gdal2tiles python cs2cs).map{ |program|
|
44
|
+
# options["#{program}_path"]
|
45
|
+
# }.each{ |program|
|
46
|
+
# which(program)
|
47
|
+
# }
|
48
|
+
|
49
|
+
create_tile_files(options)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
def which(program)
|
57
|
+
status, stdout, stderr = systemu("which #{program}")
|
58
|
+
if status.success?
|
59
|
+
STDERR.puts "which #{program}".colorize(:blue)
|
60
|
+
path = stdout.lines.first
|
61
|
+
STDERR.puts " #{path}" if path
|
62
|
+
else
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'proj4'
|
2
|
+
require 'csv'
|
3
|
+
require 'memoizable'
|
4
|
+
|
5
|
+
module GCPS2TILES; class GCPs
|
6
|
+
|
7
|
+
attr_reader :csv
|
8
|
+
include Memoizable
|
9
|
+
|
10
|
+
def transform_3857_to_4326(rw, hw, zw=0)
|
11
|
+
proj_epsg_3857 = Proj4::Projection.new(['init=epsg:3857'])
|
12
|
+
proj_epsg_4326 = Proj4::Projection.new(['init=epsg:4326'])
|
13
|
+
proj_epsg_3857.transform(proj_epsg_4326, Proj4::Point.new(rw, hw, zw))
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(csv_file_path)
|
17
|
+
@csv = CSV.table(csv_file_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def mapx_min
|
21
|
+
@csv.map{ |e| e[:mapx] }.min
|
22
|
+
end
|
23
|
+
|
24
|
+
def mapx_max
|
25
|
+
@csv.map{ |e| e[:mapx] }.max
|
26
|
+
end
|
27
|
+
|
28
|
+
def mapy_min
|
29
|
+
@csv.map{ |e| e[:mapy] }.min
|
30
|
+
end
|
31
|
+
|
32
|
+
def mapy_max
|
33
|
+
@csv.map{ |e| e[:mapy] }.max
|
34
|
+
end
|
35
|
+
|
36
|
+
def lon_min
|
37
|
+
transform_3857_to_4326(mapx_min, mapy_min).x * Proj4::RAD_TO_DEG
|
38
|
+
end
|
39
|
+
|
40
|
+
def lon_max
|
41
|
+
transform_3857_to_4326(mapx_max, mapy_max).x * Proj4::RAD_TO_DEG
|
42
|
+
end
|
43
|
+
|
44
|
+
def lat_min
|
45
|
+
transform_3857_to_4326(mapx_min, mapy_min).y * Proj4::RAD_TO_DEG
|
46
|
+
end
|
47
|
+
|
48
|
+
def lat_max
|
49
|
+
transform_3857_to_4326(mapx_max, mapy_max).y * Proj4::RAD_TO_DEG
|
50
|
+
end
|
51
|
+
|
52
|
+
def lon_avg
|
53
|
+
(lon_min + lon_max) / 2
|
54
|
+
end
|
55
|
+
|
56
|
+
def lat_avg
|
57
|
+
(lat_min + lat_max) / 2
|
58
|
+
end
|
59
|
+
|
60
|
+
def to_h
|
61
|
+
{
|
62
|
+
mapx_min:mapx_min,
|
63
|
+
mapx_max:mapx_max,
|
64
|
+
mapy_min:mapy_min,
|
65
|
+
mapy_max:mapy_max,
|
66
|
+
lon_min:lon_min,
|
67
|
+
lon_max:lon_max,
|
68
|
+
lat_min:lat_min,
|
69
|
+
lat_max:lat_max,
|
70
|
+
lon_avg:lon_avg,
|
71
|
+
lat_avg:lat_avg,
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
memoize :mapx_min, :mapx_max, :mapy_min, :mapy_max
|
76
|
+
memoize :lon_min, :lon_max, :lat_min, :lat_max, :lon_avg, :lat_avg
|
77
|
+
memoize :to_h
|
78
|
+
|
79
|
+
end; end
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gcps2tiles
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mh61503891
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: proj4rb
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: memoizable
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: systemu
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: colorize
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: bundler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.12'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.12'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '10.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '10.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.0'
|
139
|
+
description: A generator of TMS (Tile Map Service) tiles from a image and its GCPs
|
140
|
+
(Ground Control Points).
|
141
|
+
email:
|
142
|
+
- mh.on.web@gmail.com
|
143
|
+
executables:
|
144
|
+
- gcps2tiles
|
145
|
+
extensions: []
|
146
|
+
extra_rdoc_files: []
|
147
|
+
files:
|
148
|
+
- ".gitignore"
|
149
|
+
- ".rspec"
|
150
|
+
- ".travis.yml"
|
151
|
+
- Gemfile
|
152
|
+
- LICENSE.txt
|
153
|
+
- README.md
|
154
|
+
- Rakefile
|
155
|
+
- bin/console
|
156
|
+
- bin/setup
|
157
|
+
- exe/gcps2tiles
|
158
|
+
- gcps2tiles.gemspec
|
159
|
+
- lib/gcps2tiles.rb
|
160
|
+
- lib/gcps2tiles/gcps.rb
|
161
|
+
- lib/gcps2tiles/version.rb
|
162
|
+
- screenshots/gcps2tiles-20160727.png
|
163
|
+
homepage: https://github.com/mh61503891/gcps2tiles
|
164
|
+
licenses:
|
165
|
+
- MIT
|
166
|
+
metadata: {}
|
167
|
+
post_install_message:
|
168
|
+
rdoc_options: []
|
169
|
+
require_paths:
|
170
|
+
- lib
|
171
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
requirements: []
|
182
|
+
rubyforge_project:
|
183
|
+
rubygems_version: 2.6.6
|
184
|
+
signing_key:
|
185
|
+
specification_version: 4
|
186
|
+
summary: A generator of TMS (Tile Map Service) tiles from a image and its GCPs (Ground
|
187
|
+
Control Points).
|
188
|
+
test_files: []
|