rgeo-proj4 1.0.0 → 2.0.0
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 +4 -4
- data/lib/rgeo/coord_sys/proj4.rb +17 -13
- data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +8 -4
- data/lib/rgeo/proj4.rb +2 -0
- data/lib/rgeo/proj4/version.rb +3 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: add7aff85bba20a77acc75be326d9f4ace2a08fe9193db60d88fd51658ea853f
|
4
|
+
data.tar.gz: ef6b8db6bbe814ce8d3519b9fd292b90a9075c86a477101292dba490e5ae9b47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a30c4b6f99c1fb414e65529d2d938f962bbe756f07f0e85788c805d27183103dee7bf05f6580f0c0bcc4bfc30dbcaf78e841311c90073b6d13d7219b1998447
|
7
|
+
data.tar.gz: c3bd4a4042e5ee0255d8722307cf545b1a6fed5d527ab9d195c66aa4ba4922e37ab23af7be7311fac2f1036ac4448a455b9895f07f16fd8907a5da0301f7ecee
|
data/lib/rgeo/coord_sys/proj4.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -----------------------------------------------------------------------------
|
2
4
|
#
|
3
5
|
# Proj4 wrapper for RGeo
|
@@ -233,27 +235,29 @@ module RGeo
|
|
233
235
|
def transform(from_proj_, from_geometry_, to_proj_, to_factory_)
|
234
236
|
case from_geometry_
|
235
237
|
when Feature::Point
|
236
|
-
|
238
|
+
transform_point(from_proj_, from_geometry_, to_proj_, to_factory_)
|
237
239
|
when Feature::Line
|
238
|
-
to_factory_.line(from_geometry_.points.map { |p_|
|
240
|
+
to_factory_.line(from_geometry_.points.map { |p_| transform_point(from_proj_, p_, to_proj_, to_factory_) })
|
239
241
|
when Feature::LinearRing
|
240
|
-
|
242
|
+
transform_linear_ring(from_proj_, from_geometry_, to_proj_, to_factory_)
|
241
243
|
when Feature::LineString
|
242
|
-
to_factory_.line_string(from_geometry_.points.map { |p_|
|
244
|
+
to_factory_.line_string(from_geometry_.points.map { |p_| transform_point(from_proj_, p_, to_proj_, to_factory_) })
|
243
245
|
when Feature::Polygon
|
244
|
-
|
246
|
+
transform_polygon(from_proj_, from_geometry_, to_proj_, to_factory_)
|
245
247
|
when Feature::MultiPoint
|
246
|
-
to_factory_.multi_point(from_geometry_.map { |p_|
|
248
|
+
to_factory_.multi_point(from_geometry_.map { |p_| transform_point(from_proj_, p_, to_proj_, to_factory_) })
|
247
249
|
when Feature::MultiLineString
|
248
250
|
to_factory_.multi_line_string(from_geometry_.map { |g_| transform(from_proj_, g_, to_proj_, to_factory_) })
|
249
251
|
when Feature::MultiPolygon
|
250
|
-
to_factory_.multi_polygon(from_geometry_.map { |p_|
|
252
|
+
to_factory_.multi_polygon(from_geometry_.map { |p_| transform_polygon(from_proj_, p_, to_proj_, to_factory_) })
|
251
253
|
when Feature::GeometryCollection
|
252
254
|
to_factory_.collection(from_geometry_.map { |g_| transform(from_proj_, g_, to_proj_, to_factory_) })
|
253
255
|
end
|
254
256
|
end
|
255
257
|
|
256
|
-
|
258
|
+
private
|
259
|
+
|
260
|
+
def transform_point(from_proj_, from_point_, to_proj_, to_factory_)
|
257
261
|
from_factory_ = from_point_.factory
|
258
262
|
from_has_z_ = from_factory_.property(:has_z_coordinate)
|
259
263
|
from_has_m_ = from_factory_.property(:has_m_coordinate)
|
@@ -278,13 +282,13 @@ module RGeo
|
|
278
282
|
end
|
279
283
|
end
|
280
284
|
|
281
|
-
def
|
282
|
-
to_factory_.linear_ring(from_ring_.points[0..-2].map { |p_|
|
285
|
+
def transform_linear_ring(from_proj_, from_ring_, to_proj_, to_factory_)
|
286
|
+
to_factory_.linear_ring(from_ring_.points[0..-2].map { |p_| transform_point(from_proj_, p_, to_proj_, to_factory_) })
|
283
287
|
end
|
284
288
|
|
285
|
-
def
|
286
|
-
ext_ =
|
287
|
-
int_ = from_polygon_.interior_rings.map { |r_|
|
289
|
+
def transform_polygon(from_proj_, from_polygon_, to_proj_, to_factory_)
|
290
|
+
ext_ = transform_linear_ring(from_proj_, from_polygon_.exterior_ring, to_proj_, to_factory_)
|
291
|
+
int_ = from_polygon_.interior_rings.map { |r_| transform_linear_ring(from_proj_, r_, to_proj_, to_factory_) }
|
288
292
|
to_factory_.polygon(ext_, int_)
|
289
293
|
end
|
290
294
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -----------------------------------------------------------------------------
|
2
4
|
#
|
3
5
|
# SRS database interface
|
@@ -62,7 +64,7 @@ module RGeo
|
|
62
64
|
when :read_all
|
63
65
|
@populate_state = 1
|
64
66
|
when :preload
|
65
|
-
|
67
|
+
search_file(nil)
|
66
68
|
@populate_state = 2
|
67
69
|
else
|
68
70
|
@populate_state = 0
|
@@ -80,11 +82,11 @@ module RGeo
|
|
80
82
|
return @cache[ident_] if @cache && @cache.include?(ident_)
|
81
83
|
result_ = nil
|
82
84
|
if @populate_state == 0
|
83
|
-
data_ =
|
85
|
+
data_ = search_file(ident_)
|
84
86
|
result_ = Entry.new(ident_, authority: @authority, authority_code: @authority ? ident_ : nil, name: data_[1], proj4: data_[2]) if data_
|
85
87
|
@cache[ident_] = result_ if @cache
|
86
88
|
elsif @populate_state == 1
|
87
|
-
|
89
|
+
search_file(nil)
|
88
90
|
result_ = @cache[ident_]
|
89
91
|
@populate_state = 2
|
90
92
|
end
|
@@ -98,7 +100,9 @@ module RGeo
|
|
98
100
|
@populate_state = 1 if @populate_state == 2
|
99
101
|
end
|
100
102
|
|
101
|
-
|
103
|
+
private
|
104
|
+
|
105
|
+
def search_file(ident_)
|
102
106
|
::File.open(@path) do |file_|
|
103
107
|
cur_name_ = nil
|
104
108
|
cur_ident_ = nil
|
data/lib/rgeo/proj4.rb
CHANGED
data/lib/rgeo/proj4/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgeo-proj4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tee Parham, Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rgeo
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 2.
|
110
|
+
version: 2.3.0
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - ">="
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.7.
|
118
|
+
rubygems_version: 2.7.8
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Proj4 extension for rgeo.
|