rgeo 3.0.0.pre.rc.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/ext/geos_c_impl/factory.c +41 -5
- data/ext/geos_c_impl/factory.h +13 -2
- data/ext/geos_c_impl/geometry.c +151 -122
- data/ext/geos_c_impl/geometry_collection.c +17 -19
- data/ext/geos_c_impl/line_string.c +46 -36
- data/ext/geos_c_impl/point.c +0 -2
- data/ext/geos_c_impl/polygon.c +10 -11
- data/ext/geos_c_impl/polygon.h +1 -1
- data/ext/geos_c_impl/ruby_more.c +7 -0
- data/ext/geos_c_impl/ruby_more.h +8 -0
- data/lib/rgeo/cartesian/analysis.rb +5 -3
- data/lib/rgeo/cartesian/bounding_box.rb +74 -79
- data/lib/rgeo/cartesian/calculations.rb +20 -26
- data/lib/rgeo/cartesian/factory.rb +47 -49
- data/lib/rgeo/cartesian/planar_graph.rb +10 -16
- data/lib/rgeo/cartesian/sweepline_intersector.rb +1 -3
- data/lib/rgeo/cartesian/valid_op.rb +1 -3
- data/lib/rgeo/coord_sys/cs/entities.rb +87 -101
- data/lib/rgeo/coord_sys/cs/factories.rb +0 -2
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +70 -29
- data/lib/rgeo/feature/curve.rb +0 -1
- data/lib/rgeo/feature/factory.rb +25 -27
- data/lib/rgeo/feature/factory_generator.rb +3 -4
- data/lib/rgeo/feature/geometry.rb +41 -30
- data/lib/rgeo/feature/geometry_collection.rb +3 -4
- data/lib/rgeo/feature/line_string.rb +1 -2
- data/lib/rgeo/feature/linear_ring.rb +0 -1
- data/lib/rgeo/feature/multi_curve.rb +0 -1
- data/lib/rgeo/feature/multi_surface.rb +0 -1
- data/lib/rgeo/feature/point.rb +0 -1
- data/lib/rgeo/feature/polygon.rb +1 -2
- data/lib/rgeo/feature/surface.rb +0 -1
- data/lib/rgeo/feature/types.rb +73 -83
- data/lib/rgeo/geographic/factory.rb +87 -80
- data/lib/rgeo/geographic/interface.rb +40 -23
- data/lib/rgeo/geographic/projected_feature_methods.rb +2 -6
- data/lib/rgeo/geographic/projected_window.rb +35 -21
- data/lib/rgeo/geographic/simple_mercator_projector.rb +25 -13
- data/lib/rgeo/geographic/spherical_feature_methods.rb +8 -3
- data/lib/rgeo/geographic/spherical_math.rb +17 -20
- data/lib/rgeo/geos/capi_factory.rb +50 -50
- data/lib/rgeo/geos/ffi_factory.rb +41 -42
- data/lib/rgeo/geos/ffi_feature_methods.rb +72 -97
- data/lib/rgeo/geos/interface.rb +16 -16
- data/lib/rgeo/geos/utils.rb +3 -3
- data/lib/rgeo/geos/zm_factory.rb +50 -42
- data/lib/rgeo/geos/zm_feature_methods.rb +15 -8
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +4 -4
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +1 -2
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +18 -24
- data/lib/rgeo/impl_helper/basic_point_methods.rb +1 -3
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +15 -16
- data/lib/rgeo/impl_helper/utils.rb +3 -9
- data/lib/rgeo/impl_helper/valid_op.rb +12 -16
- data/lib/rgeo/version.rb +1 -1
- data/lib/rgeo/wkrep/wkb_generator.rb +42 -47
- data/lib/rgeo/wkrep/wkb_parser.rb +17 -18
- data/lib/rgeo/wkrep/wkt_generator.rb +23 -16
- data/lib/rgeo/wkrep/wkt_parser.rb +23 -13
- metadata +5 -5
@@ -147,7 +147,6 @@ module RGeo
|
|
147
147
|
# Coordinate Transformation spec.
|
148
148
|
#
|
149
149
|
# This is a non-instantiable abstract class.
|
150
|
-
|
151
150
|
class Base
|
152
151
|
# Standard object inspection output
|
153
152
|
|
@@ -158,8 +157,8 @@ module RGeo
|
|
158
157
|
# Tests for equality. Two objects are defined as equal if they
|
159
158
|
# have the same type (class) and the same WKT representation.
|
160
159
|
|
161
|
-
def eql?(
|
162
|
-
|
160
|
+
def eql?(other)
|
161
|
+
other.class == self.class && other.to_wkt == to_wkt
|
163
162
|
end
|
164
163
|
alias == eql?
|
165
164
|
|
@@ -180,19 +179,21 @@ module RGeo
|
|
180
179
|
# <tt>:standard_brackets</tt>
|
181
180
|
# If true, outputs parentheses rather than square
|
182
181
|
# brackets. Default is false.
|
183
|
-
def to_wkt(standard_brackets
|
182
|
+
def to_wkt(standard_brackets: false)
|
184
183
|
open, close = brackets(standard_brackets)
|
185
184
|
content = wkt_content(standard_brackets).map { |obj| ",#{obj}" }.join
|
186
|
-
|
187
|
-
authority
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
185
|
+
authority =
|
186
|
+
if defined?(@authority) && @authority
|
187
|
+
",AUTHORITY#{open}#{@authority.inspect},#{@authority_code.inspect}#{close}"
|
188
|
+
else
|
189
|
+
""
|
190
|
+
end
|
191
|
+
extensions =
|
192
|
+
if defined?(@extensions) && @extensions
|
193
|
+
@extensions.map { |k, v| ",EXTENSION#{open}#{k.inspect},#{v.inspect}#{close}" }.join
|
194
|
+
else
|
195
|
+
""
|
196
|
+
end
|
196
197
|
"#{wkt_typename}#{open}#{@name.inspect}#{content}#{extensions}#{authority}#{close}"
|
197
198
|
end
|
198
199
|
|
@@ -205,12 +206,11 @@ module RGeo
|
|
205
206
|
def marshal_load(data) # :nodoc:
|
206
207
|
data = data["wkt"] if data.is_a?(Hash)
|
207
208
|
temp = CS.create_from_wkt(data)
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
raise TypeError, "Bad Marshal data"
|
209
|
+
|
210
|
+
raise TypeError, "Bad Marshal data" unless temp.instance_of?(self.class)
|
211
|
+
|
212
|
+
temp.instance_variables.each do |iv|
|
213
|
+
instance_variable_set(iv, temp.instance_variable_get(iv))
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
@@ -222,12 +222,11 @@ module RGeo
|
|
222
222
|
|
223
223
|
def init_with(coder) # :nodoc:
|
224
224
|
temp = CS.create_from_wkt(coder.type == :scalar ? coder.scalar : coder["wkt"])
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
raise TypeError, "Bad YAML data"
|
225
|
+
|
226
|
+
raise TypeError, "Bad YAML data" unless temp.instance_of?(self.class)
|
227
|
+
|
228
|
+
temp.instance_variables.each do |iv|
|
229
|
+
instance_variable_set(iv, temp.instance_variable_get(iv))
|
231
230
|
end
|
232
231
|
end
|
233
232
|
|
@@ -246,7 +245,6 @@ module RGeo
|
|
246
245
|
#
|
247
246
|
# Details of axis. This is used to label axes, and indicate the
|
248
247
|
# orientation.
|
249
|
-
|
250
248
|
class AxisInfo < Base
|
251
249
|
# :stopdoc:
|
252
250
|
NAMES_BY_VALUE = %w[OTHER NORTH SOUTH EAST WEST UP DOWN].freeze
|
@@ -254,12 +252,13 @@ module RGeo
|
|
254
252
|
|
255
253
|
def initialize(name, orientation) # :nodoc:
|
256
254
|
@name = name
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
255
|
+
@orientation =
|
256
|
+
case orientation
|
257
|
+
when String, Symbol
|
258
|
+
NAMES_BY_VALUE.index(orientation.to_s.upcase).to_i
|
259
|
+
else
|
260
|
+
orientation.to_i
|
261
|
+
end
|
263
262
|
end
|
264
263
|
|
265
264
|
# Human readable name for axis. Possible values are "X", "Y",
|
@@ -301,7 +300,6 @@ module RGeo
|
|
301
300
|
# projected coordinate system. The angular units of parameter
|
302
301
|
# values match the angular units of the geographic coordinate
|
303
302
|
# system that the projected coordinate system is based on.
|
304
|
-
|
305
303
|
class ProjectionParameter < Base
|
306
304
|
def initialize(name, value) # :nodoc:
|
307
305
|
@name = name
|
@@ -339,15 +337,14 @@ module RGeo
|
|
339
337
|
# Wolf parameters should be applied to geocentric coordinates, where
|
340
338
|
# the X axis points towards the Greenwich Prime Meridian, the Y axis
|
341
339
|
# points East, and the Z axis points North.
|
342
|
-
|
343
340
|
class WGS84ConversionInfo < Base
|
344
|
-
def initialize(
|
345
|
-
@dx =
|
346
|
-
@dy =
|
347
|
-
@dz =
|
348
|
-
@ex =
|
349
|
-
@ey =
|
350
|
-
@ez =
|
341
|
+
def initialize(dx_meters, dy_meters, dz_meters, ex_arc_seconds, ey_arc_seconds, ez_arc_seconds, ppm) # :nodoc:
|
342
|
+
@dx = dx_meters.to_f
|
343
|
+
@dy = dy_meters.to_f
|
344
|
+
@dz = dz_meters.to_f
|
345
|
+
@ex = ex_arc_seconds.to_f
|
346
|
+
@ey = ey_arc_seconds.to_f
|
347
|
+
@ez = ez_arc_seconds.to_f
|
351
348
|
@ppm = ppm.to_f
|
352
349
|
end
|
353
350
|
|
@@ -372,7 +369,7 @@ module RGeo
|
|
372
369
|
# Bursa Wolf scaling in in parts per million.
|
373
370
|
attr_reader :ppm
|
374
371
|
|
375
|
-
def to_wkt(standard_brackets
|
372
|
+
def to_wkt(standard_brackets: false)
|
376
373
|
open, close = brackets(standard_brackets)
|
377
374
|
"TOWGS84#{open}#{@dx},#{@dy},#{@dz},#{@ex},#{@ey},#{@ez},#{@ppm}#{close}"
|
378
375
|
end
|
@@ -383,8 +380,8 @@ module RGeo
|
|
383
380
|
# The Bursa Wolf shift should be in meters, the rotation in arc
|
384
381
|
# seconds, and the scaling in parts per million.
|
385
382
|
|
386
|
-
def create(
|
387
|
-
new(
|
383
|
+
def create(dx_meters, dy_meters, dz_meters, ex_arc_seconds, ey_arc_seconds, ez_arc_seconds, ppm)
|
384
|
+
new(dx_meters, dy_meters, dz_meters, ex_arc_seconds, ey_arc_seconds, ez_arc_seconds, ppm)
|
388
385
|
end
|
389
386
|
end
|
390
387
|
end
|
@@ -427,9 +424,9 @@ module RGeo
|
|
427
424
|
# * <b>alias</b>: an alias
|
428
425
|
# * <b>remarks</b>: provider-supplied remarks.
|
429
426
|
# * <b>extensions</b>: a hash of extension keys and values
|
430
|
-
|
431
427
|
class Info < Base
|
432
|
-
def initialize(name, authority = nil, authority_code = nil, abbreviation = nil, init_alias = nil,
|
428
|
+
def initialize(name, authority = nil, authority_code = nil, abbreviation = nil, init_alias = nil,
|
429
|
+
remarks = nil, extensions = nil) # :nodoc:
|
433
430
|
@name = name
|
434
431
|
@authority = authority ? authority.to_s : nil
|
435
432
|
@authority_code = authority_code ? authority_code.to_s : nil
|
@@ -488,7 +485,6 @@ module RGeo
|
|
488
485
|
# Normally, you will instantiate one of the subclasses LinearUnit or
|
489
486
|
# AngularUnit. However, it is possible to instantiate Unit if it is
|
490
487
|
# not clear whether the data refers to a LinearUnit or AngularUnit.
|
491
|
-
|
492
488
|
class Unit < Info
|
493
489
|
def initialize(name, conversion_factor, *optional) # :nodoc:
|
494
490
|
super(name, *optional)
|
@@ -525,7 +521,6 @@ module RGeo
|
|
525
521
|
# == OGC spec description
|
526
522
|
#
|
527
523
|
# Definition of linear units.
|
528
|
-
|
529
524
|
class LinearUnit < Unit
|
530
525
|
# Returns the number of meters per LinearUnit.
|
531
526
|
# Also available as Unit#conversion_factor.
|
@@ -548,7 +543,6 @@ module RGeo
|
|
548
543
|
# == OGC spec description
|
549
544
|
#
|
550
545
|
# Definition of angular units.
|
551
|
-
|
552
546
|
class AngularUnit < Unit
|
553
547
|
# Returns the number of radians per AngularUnit.
|
554
548
|
# Also available as Unit#conversion_factor.
|
@@ -571,7 +565,6 @@ module RGeo
|
|
571
565
|
# == OGC spec description
|
572
566
|
#
|
573
567
|
# A meridian used to take longitude measurements from.
|
574
|
-
|
575
568
|
class PrimeMeridian < Info
|
576
569
|
def initialize(name, angular_unit, longitude, *optional) # :nodoc:
|
577
570
|
super(name, *optional)
|
@@ -611,9 +604,9 @@ module RGeo
|
|
611
604
|
# == OGC spec description
|
612
605
|
#
|
613
606
|
# An approximation of the Earth's surface as a squashed sphere.
|
614
|
-
|
615
607
|
class Ellipsoid < Info
|
616
|
-
def initialize(name, semi_major_axis, semi_minor_axis, inverse_flattening, ivf_definitive,
|
608
|
+
def initialize(name, semi_major_axis, semi_minor_axis, inverse_flattening, ivf_definitive,
|
609
|
+
linear_unit, *optional) # :nodoc:
|
617
610
|
super(name, *optional)
|
618
611
|
@semi_major_axis = semi_major_axis.to_f
|
619
612
|
@semi_minor_axis = semi_minor_axis.to_f
|
@@ -718,7 +711,6 @@ module RGeo
|
|
718
711
|
# This is a non-instantiable abstract class. You must instantiate
|
719
712
|
# one of the subclasses HorizontalDatum, VerticalDatum, or
|
720
713
|
# LocalDatum.
|
721
|
-
|
722
714
|
class Datum < Info
|
723
715
|
def initialize(name, datum_type, *optional) # :nodoc:
|
724
716
|
super(name, *optional)
|
@@ -738,7 +730,6 @@ module RGeo
|
|
738
730
|
# == OGC spec description
|
739
731
|
#
|
740
732
|
# Procedure used to measure vertical distances.
|
741
|
-
|
742
733
|
class VerticalDatum < Datum
|
743
734
|
def wkt_typename
|
744
735
|
"VERT_DATUM"
|
@@ -768,7 +759,6 @@ module RGeo
|
|
768
759
|
# coordinates can be transformed between two different local
|
769
760
|
# coordinate systems, as long as they are based on the same local
|
770
761
|
# datum.
|
771
|
-
|
772
762
|
class LocalDatum < Datum
|
773
763
|
def wkt_typename
|
774
764
|
"LOCAL_DATUM"
|
@@ -794,7 +784,6 @@ module RGeo
|
|
794
784
|
# == OGC spec description
|
795
785
|
#
|
796
786
|
# Procedure used to measure positions on the surface of the Earth.
|
797
|
-
|
798
787
|
class HorizontalDatum < Datum
|
799
788
|
def initialize(name, datum_type, ellipsoid, wgs84_parameters, *optional) # :nodoc:
|
800
789
|
super(name, datum_type, *optional)
|
@@ -828,8 +817,8 @@ module RGeo
|
|
828
817
|
private
|
829
818
|
|
830
819
|
def wkt_content(standard_brackets)
|
831
|
-
array = [@ellipsoid.to_wkt(standard_brackets)]
|
832
|
-
array << @wgs84_parameters.to_wkt(standard_brackets) if @wgs84_parameters
|
820
|
+
array = [@ellipsoid.to_wkt(standard_brackets: standard_brackets)]
|
821
|
+
array << @wgs84_parameters.to_wkt(standard_brackets: standard_brackets) if @wgs84_parameters
|
833
822
|
array
|
834
823
|
end
|
835
824
|
end
|
@@ -837,7 +826,6 @@ module RGeo
|
|
837
826
|
# == OGC spec description
|
838
827
|
#
|
839
828
|
# A projection from geographic coordinates to projected coordinates.
|
840
|
-
|
841
829
|
class Projection < Info
|
842
830
|
def initialize(name, class_name, parameters, *optional) # :nodoc:
|
843
831
|
super(name, *optional)
|
@@ -916,7 +904,6 @@ module RGeo
|
|
916
904
|
# GeographicCoordinateSystem, ProjectedCoordinateSystem,
|
917
905
|
# VerticalCoordinateSystem, LocalCoordinateSystem, or
|
918
906
|
# CompoundCoordinateSystem.
|
919
|
-
|
920
907
|
class CoordinateSystem < Info
|
921
908
|
def initialize(name, dimension, *optional) # :nodoc:
|
922
909
|
super(name, *optional)
|
@@ -929,14 +916,14 @@ module RGeo
|
|
929
916
|
# Gets axis details for dimension within coordinate system. Each
|
930
917
|
# dimension in the coordinate system has a corresponding axis.
|
931
918
|
|
932
|
-
def get_axis(
|
919
|
+
def get_axis(_dimension)
|
933
920
|
nil
|
934
921
|
end
|
935
922
|
|
936
923
|
# Gets units for dimension within coordinate system. Each
|
937
924
|
# dimension in the coordinate system has corresponding units.
|
938
925
|
|
939
|
-
def get_units(
|
926
|
+
def get_units(_dimension)
|
940
927
|
nil
|
941
928
|
end
|
942
929
|
|
@@ -993,7 +980,6 @@ module RGeo
|
|
993
980
|
# as a geographic or a projected coordinate system with a horizontal
|
994
981
|
# datum. The other is a vertical CRS which is a one-dimensional
|
995
982
|
# coordinate system with a vertical datum.
|
996
|
-
|
997
983
|
class CompoundCoordinateSystem < CoordinateSystem
|
998
984
|
def initialize(name, head, tail, *optional) # :nodoc:
|
999
985
|
super(name, head.dimension + tail.dimension, *optional)
|
@@ -1038,7 +1024,7 @@ module RGeo
|
|
1038
1024
|
private
|
1039
1025
|
|
1040
1026
|
def wkt_content(standard_brackets)
|
1041
|
-
[@head.to_wkt(standard_brackets), @tail.to_wkt(standard_brackets)]
|
1027
|
+
[@head.to_wkt(standard_brackets: standard_brackets), @tail.to_wkt(standard_brackets: standard_brackets)]
|
1042
1028
|
end
|
1043
1029
|
end
|
1044
1030
|
|
@@ -1060,7 +1046,6 @@ module RGeo
|
|
1060
1046
|
#
|
1061
1047
|
# RGeo's implementation does not provide the Coordinate
|
1062
1048
|
# Transformation (CT) package.
|
1063
|
-
|
1064
1049
|
class LocalCoordinateSystem < CoordinateSystem
|
1065
1050
|
def initialize(name, local_datum, unit, axes, *optional) # :nodoc:
|
1066
1051
|
super(name, axes.size, *optional)
|
@@ -1080,7 +1065,7 @@ module RGeo
|
|
1080
1065
|
|
1081
1066
|
# Implements CoordinateSystem#get_units
|
1082
1067
|
|
1083
|
-
def get_units(
|
1068
|
+
def get_units(_index)
|
1084
1069
|
@unit
|
1085
1070
|
end
|
1086
1071
|
|
@@ -1103,9 +1088,9 @@ module RGeo
|
|
1103
1088
|
|
1104
1089
|
def wkt_content(standard_brackets)
|
1105
1090
|
[
|
1106
|
-
@local_datum.to_wkt(standard_brackets),
|
1107
|
-
@unit.to_wkt(standard_brackets)
|
1108
|
-
] + @axes.map { |ax| ax.to_wkt(standard_brackets) }
|
1091
|
+
@local_datum.to_wkt(standard_brackets: standard_brackets),
|
1092
|
+
@unit.to_wkt(standard_brackets: standard_brackets)
|
1093
|
+
] + @axes.map { |ax| ax.to_wkt(standard_brackets: standard_brackets) }
|
1109
1094
|
end
|
1110
1095
|
end
|
1111
1096
|
|
@@ -1117,7 +1102,6 @@ module RGeo
|
|
1117
1102
|
# the Z axis will point North, and the Y axis will point East (e.g.
|
1118
1103
|
# a right handed system), but you should check the axes for
|
1119
1104
|
# non-default values.
|
1120
|
-
|
1121
1105
|
class GeocentricCoordinateSystem < CoordinateSystem
|
1122
1106
|
def initialize(name, horizontal_datum, prime_meridian, linear_unit, axis0, axis1, axis2, *optional) # :nodoc:
|
1123
1107
|
super(name, 3, *optional)
|
@@ -1143,7 +1127,7 @@ module RGeo
|
|
1143
1127
|
|
1144
1128
|
# Implements CoordinateSystem#get_units
|
1145
1129
|
|
1146
|
-
def get_units(
|
1130
|
+
def get_units(_index)
|
1147
1131
|
@linear_unit
|
1148
1132
|
end
|
1149
1133
|
|
@@ -1177,13 +1161,13 @@ module RGeo
|
|
1177
1161
|
|
1178
1162
|
def wkt_content(standard_brackets)
|
1179
1163
|
arr = [
|
1180
|
-
@horizontal_datum.to_wkt(standard_brackets),
|
1181
|
-
@prime_meridian.to_wkt(standard_brackets),
|
1182
|
-
@linear_unit.to_wkt(standard_brackets)
|
1164
|
+
@horizontal_datum.to_wkt(standard_brackets: standard_brackets),
|
1165
|
+
@prime_meridian.to_wkt(standard_brackets: standard_brackets),
|
1166
|
+
@linear_unit.to_wkt(standard_brackets: standard_brackets)
|
1183
1167
|
]
|
1184
|
-
arr << @axis0.to_wkt(standard_brackets) if @axis0
|
1185
|
-
arr << @axis1.to_wkt(standard_brackets) if @axis1
|
1186
|
-
arr << @axis2.to_wkt(standard_brackets) if @axis2
|
1168
|
+
arr << @axis0.to_wkt(standard_brackets: standard_brackets) if @axis0
|
1169
|
+
arr << @axis1.to_wkt(standard_brackets: standard_brackets) if @axis1
|
1170
|
+
arr << @axis2.to_wkt(standard_brackets: standard_brackets) if @axis2
|
1187
1171
|
arr
|
1188
1172
|
end
|
1189
1173
|
end
|
@@ -1192,7 +1176,6 @@ module RGeo
|
|
1192
1176
|
#
|
1193
1177
|
# A one-dimensional coordinate system suitable for vertical
|
1194
1178
|
# measurements.
|
1195
|
-
|
1196
1179
|
class VerticalCoordinateSystem < CoordinateSystem
|
1197
1180
|
def initialize(name, vertical_datum, vertical_unit, axis, *optional) # :nodoc:
|
1198
1181
|
super(name, 1, *optional)
|
@@ -1210,13 +1193,13 @@ module RGeo
|
|
1210
1193
|
|
1211
1194
|
# Implements CoordinateSystem#get_units
|
1212
1195
|
|
1213
|
-
def get_units(
|
1196
|
+
def get_units(_index)
|
1214
1197
|
@vertical_unit
|
1215
1198
|
end
|
1216
1199
|
|
1217
1200
|
# Implements CoordinateSystem#get_axis
|
1218
1201
|
|
1219
|
-
def get_axis(
|
1202
|
+
def get_axis(_index)
|
1220
1203
|
@axis
|
1221
1204
|
end
|
1222
1205
|
|
@@ -1238,8 +1221,11 @@ module RGeo
|
|
1238
1221
|
private
|
1239
1222
|
|
1240
1223
|
def wkt_content(standard_brackets)
|
1241
|
-
arr = [
|
1242
|
-
|
1224
|
+
arr = [
|
1225
|
+
@vertical_datum.to_wkt(standard_brackets: standard_brackets),
|
1226
|
+
@vertical_unit.to_wkt(standard_brackets: standard_brackets)
|
1227
|
+
]
|
1228
|
+
arr << @axis.to_wkt(standard_brackets: standard_brackets) if @axis
|
1243
1229
|
arr
|
1244
1230
|
end
|
1245
1231
|
end
|
@@ -1253,7 +1239,6 @@ module RGeo
|
|
1253
1239
|
# This is a non-instantiable abstract class. You must instantiate
|
1254
1240
|
# one of the subclasses GeographicCoordinateSystem or
|
1255
1241
|
# ProjectedCoordinateSystem.
|
1256
|
-
|
1257
1242
|
class HorizontalCoordinateSystem < CoordinateSystem
|
1258
1243
|
def initialize(name, horizontal_datum, *optional) # :nodoc:
|
1259
1244
|
super(name, 2, *optional)
|
@@ -1271,7 +1256,6 @@ module RGeo
|
|
1271
1256
|
# You can find out which this is by examining the axes. You should
|
1272
1257
|
# also check the angular units, since not all geographic coordinate
|
1273
1258
|
# systems use degrees.
|
1274
|
-
|
1275
1259
|
class GeographicCoordinateSystem < HorizontalCoordinateSystem
|
1276
1260
|
def initialize(name, angular_unit, horizontal_datum, prime_meridian, axis0, axis1, *optional) # :nodoc:
|
1277
1261
|
super(name, horizontal_datum, *optional)
|
@@ -1290,7 +1274,7 @@ module RGeo
|
|
1290
1274
|
|
1291
1275
|
# Implements CoordinateSystem#get_units
|
1292
1276
|
|
1293
|
-
def get_units(
|
1277
|
+
def get_units(_index)
|
1294
1278
|
@angular_unit
|
1295
1279
|
end
|
1296
1280
|
|
@@ -1312,7 +1296,7 @@ module RGeo
|
|
1312
1296
|
# of interest. The first conversion (with index=0) should provide
|
1313
1297
|
# acceptable accuracy over the largest possible area of interest.
|
1314
1298
|
|
1315
|
-
def get_wgs84_conversion_info(
|
1299
|
+
def get_wgs84_conversion_info(_index)
|
1316
1300
|
@horizontal_datum.wgs84_parameters
|
1317
1301
|
end
|
1318
1302
|
|
@@ -1340,12 +1324,12 @@ module RGeo
|
|
1340
1324
|
|
1341
1325
|
def wkt_content(standard_brackets)
|
1342
1326
|
arr = [
|
1343
|
-
@horizontal_datum.to_wkt(standard_brackets),
|
1344
|
-
@prime_meridian.to_wkt(standard_brackets),
|
1345
|
-
@angular_unit.to_wkt(standard_brackets)
|
1327
|
+
@horizontal_datum.to_wkt(standard_brackets: standard_brackets),
|
1328
|
+
@prime_meridian.to_wkt(standard_brackets: standard_brackets),
|
1329
|
+
@angular_unit.to_wkt(standard_brackets: standard_brackets)
|
1346
1330
|
]
|
1347
|
-
arr << @axis0.to_wkt(standard_brackets) if @axis0
|
1348
|
-
arr << @axis1.to_wkt(standard_brackets) if @axis1
|
1331
|
+
arr << @axis0.to_wkt(standard_brackets: standard_brackets) if @axis0
|
1332
|
+
arr << @axis1.to_wkt(standard_brackets: standard_brackets) if @axis1
|
1349
1333
|
arr
|
1350
1334
|
end
|
1351
1335
|
end
|
@@ -1353,7 +1337,6 @@ module RGeo
|
|
1353
1337
|
# == OGC spec description
|
1354
1338
|
#
|
1355
1339
|
# A 2D cartographic coordinate system.
|
1356
|
-
|
1357
1340
|
class ProjectedCoordinateSystem < HorizontalCoordinateSystem
|
1358
1341
|
def initialize(name, geographic_coordinate_system, projection, linear_unit, axis0, axis1, *optional) # :nodoc:
|
1359
1342
|
super(name, geographic_coordinate_system.horizontal_datum, *optional)
|
@@ -1376,7 +1359,7 @@ module RGeo
|
|
1376
1359
|
|
1377
1360
|
# Implements CoordinateSystem#get_units
|
1378
1361
|
|
1379
|
-
def get_units(
|
1362
|
+
def get_units(_index)
|
1380
1363
|
@linear_unit
|
1381
1364
|
end
|
1382
1365
|
|
@@ -1409,11 +1392,14 @@ module RGeo
|
|
1409
1392
|
private
|
1410
1393
|
|
1411
1394
|
def wkt_content(standard_brackets)
|
1412
|
-
arr = [
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
arr <<
|
1395
|
+
arr = [
|
1396
|
+
@geographic_coordinate_system.to_wkt(standard_brackets: standard_brackets),
|
1397
|
+
@projection.to_wkt(standard_brackets: standard_brackets)
|
1398
|
+
]
|
1399
|
+
@projection.each_parameter { |param| arr << param.to_wkt(standard_brackets: standard_brackets) }
|
1400
|
+
arr << @linear_unit.to_wkt(standard_brackets: standard_brackets)
|
1401
|
+
arr << @axis0.to_wkt(standard_brackets: standard_brackets) if @axis0
|
1402
|
+
arr << @axis1.to_wkt(standard_brackets: standard_brackets) if @axis1
|
1417
1403
|
arr
|
1418
1404
|
end
|
1419
1405
|
end
|
@@ -1560,8 +1546,8 @@ module RGeo
|
|
1560
1546
|
private
|
1561
1547
|
|
1562
1548
|
def wkt_content(standard_brackets)
|
1563
|
-
source_cs_wkt = "SOURCECS[#{source_cs.to_wkt(standard_brackets)}]"
|
1564
|
-
target_cs_wkt = "TARGETCS[#{target_cs.to_wkt(standard_brackets)}]"
|
1549
|
+
source_cs_wkt = "SOURCECS[#{source_cs.to_wkt(standard_brackets: standard_brackets)}]"
|
1550
|
+
target_cs_wkt = "TARGETCS[#{target_cs.to_wkt(standard_brackets: standard_brackets)}]"
|
1565
1551
|
|
1566
1552
|
[source_cs_wkt, target_cs_wkt]
|
1567
1553
|
end
|
@@ -28,7 +28,6 @@ module RGeo
|
|
28
28
|
# * FittedCoordinateSystem is not implemented.
|
29
29
|
# * The defaultEnvelope attribute of CS_CoordinateSystem is not
|
30
30
|
# implemented.
|
31
|
-
|
32
31
|
module CS
|
33
32
|
# A class implementing the CS_CoordinateSystemFactory interface.
|
34
33
|
# It provides methods for building up complex objects from simpler
|
@@ -37,7 +36,6 @@ module RGeo
|
|
37
36
|
# Note that the methods of CS_CoordinateSystemFactory do not provide
|
38
37
|
# facilities for setting the authority. If you need to set authority
|
39
38
|
# values, use the create methods for the object classes themselves.
|
40
|
-
|
41
39
|
class CoordinateSystemFactory
|
42
40
|
# Create a CompoundCoordinateSystem from a name, and two
|
43
41
|
# constituent coordinate systems.
|