rgeo 0.1.21 → 0.1.22
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.
- data/History.rdoc +11 -0
- data/README.rdoc +1 -1
- data/Spatial_Programming_With_RGeo.rdoc +382 -0
- data/Version +1 -1
- data/lib/active_record/connection_adapters/postgis_adapter.rb +1 -1
- data/lib/rgeo.rb +4 -4
- data/lib/rgeo/active_record/base_modifications.rb +1 -1
- data/lib/rgeo/all.rb +1 -1
- data/lib/rgeo/cartesian/bounding_box.rb +2 -2
- data/lib/rgeo/cartesian/factory.rb +18 -11
- data/lib/rgeo/cartesian/interface.rb +4 -4
- data/lib/rgeo/coord_sys.rb +8 -1
- data/lib/rgeo/coord_sys/proj4.rb +4 -4
- data/lib/rgeo/feature/factory.rb +68 -49
- data/lib/rgeo/feature/factory_generator.rb +2 -2
- data/lib/rgeo/feature/types.rb +4 -4
- data/lib/rgeo/geo_json/coder.rb +5 -5
- data/lib/rgeo/{geography.rb → geographic.rb} +15 -15
- data/lib/rgeo/{geography → geographic}/factory.rb +27 -20
- data/lib/rgeo/{geography → geographic}/interface.rb +43 -29
- data/lib/rgeo/{geography → geographic}/proj4_projector.rb +2 -2
- data/lib/rgeo/{geography → geographic}/projected_feature_classes.rb +2 -2
- data/lib/rgeo/{geography → geographic}/projected_feature_methods.rb +2 -2
- data/lib/rgeo/{geography → geographic}/projected_window.rb +5 -5
- data/lib/rgeo/{geography → geographic}/simple_mercator_projector.rb +2 -2
- data/lib/rgeo/{geography → geographic}/spherical_feature_classes.rb +2 -2
- data/lib/rgeo/{geography → geographic}/spherical_feature_methods.rb +2 -2
- data/lib/rgeo/{geography → geographic}/spherical_math.rb +1 -1
- data/lib/rgeo/geos/factory.rb +22 -15
- data/lib/rgeo/geos/interface.rb +3 -3
- data/lib/rgeo/geos/zm_factory.rb +20 -6
- data/lib/rgeo/impl_helper/basic_point_methods.rb +2 -2
- data/lib/rgeo/shapefile/reader.rb +5 -5
- data/lib/rgeo/wkrep/wkb_generator.rb +2 -2
- data/lib/rgeo/wkrep/wkb_parser.rb +4 -4
- data/lib/rgeo/wkrep/wkt_generator.rb +2 -2
- data/lib/rgeo/wkrep/wkt_parser.rb +7 -7
- data/test/active_record/common_setup_methods.rb +1 -1
- data/test/geos/tc_point.rb +3 -3
- data/test/geos/tc_zmfactory.rb +7 -7
- data/test/{projected_geography → projected_geographic}/tc_geometry_collection.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_line_string.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_multi_line_string.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_multi_point.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_multi_polygon.rb +3 -3
- data/test/{projected_geography → projected_geographic}/tc_point.rb +5 -5
- data/test/{projected_geography → projected_geographic}/tc_polygon.rb +2 -2
- data/test/shapefile/tc_shapelib_tests.rb +10 -10
- data/test/simple_cartesian/tc_point.rb +3 -3
- data/test/simple_mercator/tc_geometry_collection.rb +1 -1
- data/test/simple_mercator/tc_line_string.rb +1 -1
- data/test/simple_mercator/tc_multi_line_string.rb +1 -1
- data/test/simple_mercator/tc_multi_point.rb +1 -1
- data/test/simple_mercator/tc_multi_polygon.rb +2 -2
- data/test/simple_mercator/tc_point.rb +4 -4
- data/test/simple_mercator/tc_polygon.rb +1 -1
- data/test/simple_mercator/tc_window.rb +39 -39
- data/test/spherical_geographic/tc_calculations.rb +203 -0
- data/test/{spherical_geography → spherical_geographic}/tc_geometry_collection.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_line_string.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_multi_line_string.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_multi_point.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_multi_polygon.rb +3 -3
- data/test/{spherical_geography → spherical_geographic}/tc_point.rb +6 -6
- data/test/{spherical_geography → spherical_geographic}/tc_polygon.rb +2 -2
- data/test/tc_geojson.rb +3 -3
- data/test/tc_oneoff.rb +5 -5
- data/test/wkrep/tc_wkb_generator.rb +3 -3
- data/test/wkrep/tc_wkb_parser.rb +16 -16
- data/test/wkrep/tc_wkt_generator.rb +3 -3
- data/test/wkrep/tc_wkt_parser.rb +21 -21
- metadata +46 -44
- data/test/spherical_geography/tc_calculations.rb +0 -203
@@ -68,7 +68,7 @@ module ActiveRecord
|
|
68
68
|
class_attribute :rgeo_factory_generator, :instance_writer => false
|
69
69
|
self.rgeo_factory_generator = ::Proc.new do |config_|
|
70
70
|
if config_.delete(:geographic)
|
71
|
-
::RGeo::
|
71
|
+
::RGeo::Geographic.spherical_factory(config_)
|
72
72
|
else
|
73
73
|
::RGeo::Cartesian.preferred_factory(config_)
|
74
74
|
end
|
data/lib/rgeo/all.rb
CHANGED
@@ -73,8 +73,8 @@ module RGeo
|
|
73
73
|
|
74
74
|
def initialize(factory_, opts_={})
|
75
75
|
@factory = factory_
|
76
|
-
@has_z = !opts_[:ignore_z] && factory_.
|
77
|
-
@has_m = !opts_[:ignore_m] && factory_.
|
76
|
+
@has_z = !opts_[:ignore_z] && factory_.property(:has_z_coordinate) ? true : false
|
77
|
+
@has_m = !opts_[:ignore_m] && factory_.property(:has_m_coordinate) ? true : false
|
78
78
|
@min_x = @max_x = @min_y = @max_y = @min_z = @max_z = @min_m = @max_m = nil
|
79
79
|
end
|
80
80
|
|
@@ -53,8 +53,8 @@ module RGeo
|
|
53
53
|
|
54
54
|
def initialize(opts_={})
|
55
55
|
@srid = opts_[:srid].to_i
|
56
|
-
@
|
57
|
-
@
|
56
|
+
@has_z = opts_[:has_z_coordinate] ? true : false
|
57
|
+
@has_m = opts_[:has_m_coordinate] ? true : false
|
58
58
|
@proj4 = opts_[:proj4]
|
59
59
|
if CoordSys::Proj4.supported?
|
60
60
|
if @proj4.kind_of?(::String) || @proj4.kind_of?(::Hash)
|
@@ -69,7 +69,7 @@ module RGeo
|
|
69
69
|
# Equivalence test.
|
70
70
|
|
71
71
|
def eql?(rhs_)
|
72
|
-
rhs_.is_a?(self.class) && @srid == rhs_.srid
|
72
|
+
rhs_.is_a?(self.class) && @srid == rhs_.srid && @has_z == rhs_.property(:has_z_coordinate) && @has_m == rhs_.property(:has_m_coordinate)
|
73
73
|
end
|
74
74
|
alias_method :==, :eql?
|
75
75
|
|
@@ -81,16 +81,16 @@ module RGeo
|
|
81
81
|
end
|
82
82
|
|
83
83
|
|
84
|
-
# See ::RGeo::Feature::Factory#
|
84
|
+
# See ::RGeo::Feature::Factory#property
|
85
85
|
|
86
|
-
def
|
86
|
+
def property(name_)
|
87
87
|
case name_
|
88
|
-
when :
|
89
|
-
@
|
90
|
-
when :
|
91
|
-
@
|
92
|
-
when :
|
93
|
-
|
88
|
+
when :has_z_coordinate
|
89
|
+
@has_z
|
90
|
+
when :has_m_coordinate
|
91
|
+
@has_m
|
92
|
+
when :is_cartesian
|
93
|
+
true
|
94
94
|
else
|
95
95
|
nil
|
96
96
|
end
|
@@ -181,6 +181,13 @@ module RGeo
|
|
181
181
|
end
|
182
182
|
|
183
183
|
|
184
|
+
# See ::RGeo::Feature::Factory#coord_sys
|
185
|
+
|
186
|
+
def coord_sys
|
187
|
+
nil
|
188
|
+
end
|
189
|
+
|
190
|
+
|
184
191
|
end
|
185
192
|
|
186
193
|
|
@@ -89,10 +89,10 @@ module RGeo
|
|
89
89
|
# <tt>:srid</tt>::
|
90
90
|
# Set the SRID returned by geometries created by this factory.
|
91
91
|
# Default is 0.
|
92
|
-
# <tt>:
|
93
|
-
# Support
|
94
|
-
# <tt>:
|
95
|
-
# Support
|
92
|
+
# <tt>:has_z_coordinate</tt>::
|
93
|
+
# Support a Z coordinate. Default is false.
|
94
|
+
# <tt>:has_m_coordinate</tt>::
|
95
|
+
# Support an M coordinate. Default is false.
|
96
96
|
|
97
97
|
def simple_factory(opts_={})
|
98
98
|
Cartesian::Factory.new(opts_)
|
data/lib/rgeo/coord_sys.rb
CHANGED
@@ -41,7 +41,14 @@ require 'rgeo'
|
|
41
41
|
module RGeo
|
42
42
|
|
43
43
|
|
44
|
-
#
|
44
|
+
# This module provides data structures and tools related to coordinate
|
45
|
+
# systems and coordinate transforms.
|
46
|
+
#
|
47
|
+
# Currently, the Proj4 class provides a wrapper around the proj4
|
48
|
+
# library, which specifies geographic and projected coordinate systems
|
49
|
+
# and performs transformations. In the future, this module will also
|
50
|
+
# contain an implementation of the OGC coordinate transformation
|
51
|
+
# specification.
|
45
52
|
|
46
53
|
module CoordSys
|
47
54
|
end
|
data/lib/rgeo/coord_sys/proj4.rb
CHANGED
@@ -240,10 +240,10 @@ module RGeo
|
|
240
240
|
|
241
241
|
def _transform_point(from_proj_, from_point_, to_proj_, to_factory_) # :nodoc:
|
242
242
|
from_factory_ = from_point_.factory
|
243
|
-
from_has_z_ = from_factory_.
|
244
|
-
from_has_m_ = from_factory_.
|
245
|
-
to_has_z_ = to_factory_.
|
246
|
-
to_has_m_ = to_factory_.
|
243
|
+
from_has_z_ = from_factory_.property(:has_z_coordinate)
|
244
|
+
from_has_m_ = from_factory_.property(:has_m_coordinate)
|
245
|
+
to_has_z_ = to_factory_.property(:has_z_coordinate)
|
246
|
+
to_has_m_ = to_factory_.property(:has_m_coordinate)
|
247
247
|
coords_ = _transform_coords(from_proj_, to_proj_, from_point_.x, from_point_.y,
|
248
248
|
from_has_z_ ? from_point_.z : nil)
|
249
249
|
extras_ = []
|
data/lib/rgeo/feature/factory.rb
CHANGED
@@ -72,35 +72,42 @@ module RGeo
|
|
72
72
|
end
|
73
73
|
|
74
74
|
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
# certain capabilities or operations. Most queries return a boolean
|
79
|
-
# value, though some may return other values to indicate different
|
80
|
-
# levels of support. Generally speaking, if a query returns a false
|
81
|
-
# or nil value, support for that capability is not guaranteed, and
|
82
|
-
# calls related to that function may fail or raise exceptions.
|
75
|
+
# Returns meta-information about this factory, by key. This
|
76
|
+
# information may involve support for optional functionality,
|
77
|
+
# properties of the coordinate system, or other characteristics.
|
83
78
|
#
|
84
|
-
# Each
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
79
|
+
# Each property has a symbolic name. Names that have no periods are
|
80
|
+
# considered well-known names and are reserved for use by RGeo. If
|
81
|
+
# you want to define your own capabilities, use a name that is
|
82
|
+
# namespaced with periods, such as <tt>:'mycompany.myprop'</tt>.
|
88
83
|
#
|
89
|
-
#
|
84
|
+
# Property values are dependent on the individual property.
|
85
|
+
# Generally, properties that involve testing for functionality
|
86
|
+
# should return true if the functionality is support, or false or
|
87
|
+
# nil if not. A property value could also invlove different values
|
88
|
+
# indicating different levels of support. In any case, the factory
|
89
|
+
# should return nil for property names it does not recognize. This
|
90
|
+
# value is considered the "default" or "no value" value.
|
90
91
|
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
# Point#
|
99
|
-
# <tt>:
|
100
|
-
#
|
101
|
-
#
|
102
|
-
|
103
|
-
|
92
|
+
# Currently defined well-known properties are:
|
93
|
+
#
|
94
|
+
# <tt>:has_z_coordinate</tt>::
|
95
|
+
# Set to true if geometries created by this factory include a Z
|
96
|
+
# coordinate, and the Point#z method is available.
|
97
|
+
# <tt>:has_m_coordinate</tt>::
|
98
|
+
# Set to true if geometries created by this factory include a M
|
99
|
+
# coordinate, and the Point#z method is available.
|
100
|
+
# <tt>:is_cartesian</tt>::
|
101
|
+
# Set to true if this Factory guarantees that it operates in
|
102
|
+
# Cartesian geometry. If false or nil, no such guarantee is made,
|
103
|
+
# though it is possible the geometries may still be Cartesian.
|
104
|
+
# <tt>:is_geographic</tt>::
|
105
|
+
# Set to true if this Factory's coordinate system is meant to be
|
106
|
+
# interpreted as x=longitude and y=latitude. If false or nil, no
|
107
|
+
# information is present about whether the coordinate system is
|
108
|
+
# meant to be so interpreted.
|
109
|
+
|
110
|
+
def property(name_)
|
104
111
|
nil
|
105
112
|
end
|
106
113
|
|
@@ -135,7 +142,7 @@ module RGeo
|
|
135
142
|
|
136
143
|
# Create a feature of type LineString.
|
137
144
|
# The given points argument should be an Enumerable of Point
|
138
|
-
# objects, or objects that can be
|
145
|
+
# objects, or objects that can be cast to Point.
|
139
146
|
|
140
147
|
def line_string(points_)
|
141
148
|
nil
|
@@ -144,7 +151,7 @@ module RGeo
|
|
144
151
|
|
145
152
|
# Create a feature of type Line.
|
146
153
|
# The given point arguments should be Point objects, or objects
|
147
|
-
# that can be
|
154
|
+
# that can be cast to Point.
|
148
155
|
|
149
156
|
def line(start_, end_)
|
150
157
|
nil
|
@@ -153,7 +160,7 @@ module RGeo
|
|
153
160
|
|
154
161
|
# Create a feature of type LinearRing.
|
155
162
|
# The given points argument should be an Enumerable of Point
|
156
|
-
# objects, or objects that can be
|
163
|
+
# objects, or objects that can be cast to Point.
|
157
164
|
# If the first and last points are not equal, the ring is
|
158
165
|
# automatically closed by appending the first point to the end of the
|
159
166
|
# string.
|
@@ -165,7 +172,7 @@ module RGeo
|
|
165
172
|
|
166
173
|
# Create a feature of type Polygon.
|
167
174
|
# The outer_ring should be a LinearRing, or an object that can be
|
168
|
-
#
|
175
|
+
# cast to LinearRing.
|
169
176
|
# The inner_rings should be a possibly empty Enumerable of
|
170
177
|
# LinearRing (or objects that can be casted to LinearRing).
|
171
178
|
# You may also pass nil to indicate no inner rings.
|
@@ -185,7 +192,7 @@ module RGeo
|
|
185
192
|
|
186
193
|
# Create a feature of type MultiPoint.
|
187
194
|
# The elems should be an Enumerable of Point objects, or objects
|
188
|
-
# that can be
|
195
|
+
# that can be cast to Point.
|
189
196
|
# Returns nil if any of the contained geometries is not a Point,
|
190
197
|
# which would break the MultiPoint contract.
|
191
198
|
|
@@ -196,7 +203,7 @@ module RGeo
|
|
196
203
|
|
197
204
|
# Create a feature of type MultiLineString.
|
198
205
|
# The elems should be an Enumerable of objects that are or can be
|
199
|
-
#
|
206
|
+
# cast to LineString or any of its subclasses.
|
200
207
|
# Returns nil if any of the contained geometries is not a
|
201
208
|
# LineString, which would break the MultiLineString contract.
|
202
209
|
|
@@ -207,17 +214,39 @@ module RGeo
|
|
207
214
|
|
208
215
|
# Create a feature of type MultiPolygon.
|
209
216
|
# The elems should be an Enumerable of objects that are or can be
|
210
|
-
#
|
217
|
+
# cast to Polygon or any of its subclasses.
|
211
218
|
# Returns nil if any of the contained geometries is not a Polygon,
|
212
219
|
# which would break the MultiPolygon contract.
|
213
220
|
# Also returns nil if any of the other assertions for MultiPolygon
|
214
|
-
# are not met
|
221
|
+
# are not met, e.g. if any of the polygons overlap.
|
215
222
|
|
216
223
|
def multi_polygon(elems_)
|
217
224
|
nil
|
218
225
|
end
|
219
226
|
|
220
227
|
|
228
|
+
# Returns a RGeo::CoordSys::Proj4 representing the projection for
|
229
|
+
# the coordinate system of features created by this factory, or nil
|
230
|
+
# if there is no such proj4 projection.
|
231
|
+
|
232
|
+
def proj4
|
233
|
+
nil
|
234
|
+
end
|
235
|
+
|
236
|
+
|
237
|
+
# Returns the coordinate system specification for the features
|
238
|
+
# created by this factory, or nil if there is no such coordinate
|
239
|
+
# system.
|
240
|
+
#
|
241
|
+
# NOTE: This is a required method of the factory interface, but the
|
242
|
+
# coordinate system objects themselves are not yet available, so
|
243
|
+
# implementations should just return nil for now.
|
244
|
+
|
245
|
+
def coord_sys
|
246
|
+
nil
|
247
|
+
end
|
248
|
+
|
249
|
+
|
221
250
|
# This is an optional method that may be implemented to customize
|
222
251
|
# casting for this factory. Basically, RGeo defines standard ways
|
223
252
|
# to cast certain types of objects from one factory to another and
|
@@ -237,11 +266,14 @@ module RGeo
|
|
237
266
|
# of the current type
|
238
267
|
# <tt>:force_new</tt>::
|
239
268
|
# indicates whether to force the creation of a new object even if
|
240
|
-
# the original is already of the desired factory and type
|
269
|
+
# the original is already of the desired factory and type
|
270
|
+
# <tt>:project</tt>::
|
271
|
+
# indicates whether to project the coordinates from the source to
|
272
|
+
# the destination proj4 coordinate system, if available
|
241
273
|
#
|
242
274
|
# It should return either a casted result object, false, or nil.
|
243
275
|
# A nil return value indicates that casting should be forced to
|
244
|
-
# fail (and
|
276
|
+
# fail (and RGeo::Feature::cast will return nil).
|
245
277
|
# A false return value indicates that this method declines to
|
246
278
|
# override the casting algorithm, and RGeo should use its default
|
247
279
|
# algorithm to cast the object. Therefore, by default, you should
|
@@ -252,19 +284,6 @@ module RGeo
|
|
252
284
|
end
|
253
285
|
|
254
286
|
|
255
|
-
# This is an optional method that returns a RGeo::CoordSys::Proj4
|
256
|
-
# representing the projection for the coordinate system of features
|
257
|
-
# created by this factory, or nil if there is no such proj4
|
258
|
-
# projection.
|
259
|
-
#
|
260
|
-
# If a factory supports this method, it should indicate this by
|
261
|
-
# returning true for the <tt>:proj4</tt> capability.
|
262
|
-
|
263
|
-
def proj4
|
264
|
-
nil
|
265
|
-
end
|
266
|
-
|
267
|
-
|
268
287
|
end
|
269
288
|
|
270
289
|
|
@@ -89,10 +89,10 @@ module RGeo
|
|
89
89
|
# <tt>:srid</tt>::
|
90
90
|
# The SRID for the factory and objects it creates.
|
91
91
|
# Default is usually 0.
|
92
|
-
# <tt>:
|
92
|
+
# <tt>:has_z_coordinate</tt>::
|
93
93
|
# Support the <tt>z_coordinate</tt> capability.
|
94
94
|
# Default is usually false.
|
95
|
-
# <tt>:
|
95
|
+
# <tt>:has_m_coordinate</tt>::
|
96
96
|
# Support the <tt>m_coordinate</tt> capability.
|
97
97
|
# Default is usually false.
|
98
98
|
|
data/lib/rgeo/feature/types.rb
CHANGED
@@ -189,12 +189,12 @@ module RGeo
|
|
189
189
|
else
|
190
190
|
if type_ == Point
|
191
191
|
proj_ = nproj_ = nil
|
192
|
-
if project_
|
192
|
+
if project_
|
193
193
|
proj_ = factory_.proj4
|
194
194
|
nproj_ = nfactory_.proj4
|
195
195
|
end
|
196
|
-
hasz_ = factory_.
|
197
|
-
nhasz_ = nfactory_.
|
196
|
+
hasz_ = factory_.property(:has_z_coordinate)
|
197
|
+
nhasz_ = nfactory_.property(:has_z_coordinate)
|
198
198
|
if proj_ && nproj_
|
199
199
|
coords_ = CoordSys::Proj4.transform_coords(proj_, nproj_, obj_.x, obj_.y, hasz_ ? obj_.z : nil)
|
200
200
|
coords_ << (hasz_ ? obj_.z : 0.0) if nhasz_ && coords_.size < 3
|
@@ -202,7 +202,7 @@ module RGeo
|
|
202
202
|
coords_ = [obj_.x, obj_.y]
|
203
203
|
coords_ << (hasz_ ? obj_.z : 0.0) if nhasz_
|
204
204
|
end
|
205
|
-
coords_ << (factory_.
|
205
|
+
coords_ << (factory_.property(:has_m_coordinate) ? obj_.m : 0.0) if nfactory_.property(:has_m_coordinate)
|
206
206
|
nfactory_.point(*coords_)
|
207
207
|
elsif type_ == Line
|
208
208
|
nfactory_.line(cast(obj_.start_point, nfactory_, opts_), cast(obj_.end_point, nfactory_, opts_))
|
data/lib/rgeo/geo_json/coder.rb
CHANGED
@@ -131,8 +131,8 @@ module RGeo
|
|
131
131
|
raise ::ArgumentError, "Unrecognzied json_parser: #{@json_parser.inspect}"
|
132
132
|
end
|
133
133
|
@num_coordinates = 2
|
134
|
-
@num_coordinates += 1 if @geo_factory.
|
135
|
-
@num_coordinates += 1 if @geo_factory.
|
134
|
+
@num_coordinates += 1 if @geo_factory.property(:has_z_coordinate)
|
135
|
+
@num_coordinates += 1 if @geo_factory.property(:has_m_coordinate)
|
136
136
|
end
|
137
137
|
|
138
138
|
|
@@ -222,14 +222,14 @@ module RGeo
|
|
222
222
|
|
223
223
|
def _encode_geometry(object_, point_encoder_=nil) # :nodoc:
|
224
224
|
unless point_encoder_
|
225
|
-
if object_.factory.
|
226
|
-
if object_.factory.
|
225
|
+
if object_.factory.property(:has_z_coordinate)
|
226
|
+
if object_.factory.property(:has_m_coordinate)
|
227
227
|
point_encoder_ = ::Proc.new{ |p_| [p_.x, p_.y, p_.z, p_.m] }
|
228
228
|
else
|
229
229
|
point_encoder_ = ::Proc.new{ |p_| [p_.x, p_.y, p_.z] }
|
230
230
|
end
|
231
231
|
else
|
232
|
-
if object_.factory.
|
232
|
+
if object_.factory.property(:has_m_coordinate)
|
233
233
|
point_encoder_ = ::Proc.new{ |p_| [p_.x, p_.y, p_.m] }
|
234
234
|
else
|
235
235
|
point_encoder_ = ::Proc.new{ |p_| [p_.x, p_.y] }
|
@@ -41,25 +41,25 @@ require 'rgeo'
|
|
41
41
|
module RGeo
|
42
42
|
|
43
43
|
|
44
|
-
# The
|
44
|
+
# The Geographic implementation actually comprises a suite of
|
45
45
|
# implementations with one common feature: they represent geographic
|
46
46
|
# latitude/longitude coordinates measured in degrees. The "x"
|
47
47
|
# coordinate corresponds to longitude, and the "y" coordinate to
|
48
48
|
# latitude. Thus, coordinates are often expressed in reverse
|
49
49
|
# (i.e. long-lat) order. e.g.
|
50
50
|
#
|
51
|
-
# location =
|
51
|
+
# location = geographic_factory.point(long, lat)
|
52
52
|
#
|
53
|
-
# Some
|
53
|
+
# Some geographic implementations include a secondary factory that
|
54
54
|
# represents a projection. For these implementations, you can quickly
|
55
55
|
# transform data between lat/long coordinates and the projected
|
56
56
|
# coordinate system, and most calculations are done in the projected
|
57
57
|
# coordinate system. For implementations that do not include this
|
58
58
|
# secondary projection factory, calculations are done on the sphereoid.
|
59
|
-
# See the various class methods of
|
59
|
+
# See the various class methods of Geographic for more information on
|
60
60
|
# the behaviors of the factories they generate.
|
61
61
|
|
62
|
-
module
|
62
|
+
module Geographic
|
63
63
|
end
|
64
64
|
|
65
65
|
|
@@ -74,13 +74,13 @@ require 'rgeo/impl_helper'
|
|
74
74
|
require 'rgeo/cartesian'
|
75
75
|
|
76
76
|
# Implementation files.
|
77
|
-
require 'rgeo/
|
78
|
-
require 'rgeo/
|
79
|
-
require 'rgeo/
|
80
|
-
require 'rgeo/
|
81
|
-
require 'rgeo/
|
82
|
-
require 'rgeo/
|
83
|
-
require 'rgeo/
|
84
|
-
require 'rgeo/
|
85
|
-
require 'rgeo/
|
86
|
-
require 'rgeo/
|
77
|
+
require 'rgeo/geographic/factory'
|
78
|
+
require 'rgeo/geographic/projected_window'
|
79
|
+
require 'rgeo/geographic/interface'
|
80
|
+
require 'rgeo/geographic/spherical_math'
|
81
|
+
require 'rgeo/geographic/spherical_feature_methods'
|
82
|
+
require 'rgeo/geographic/spherical_feature_classes'
|
83
|
+
require 'rgeo/geographic/proj4_projector'
|
84
|
+
require 'rgeo/geographic/simple_mercator_projector'
|
85
|
+
require 'rgeo/geographic/projected_feature_methods'
|
86
|
+
require 'rgeo/geographic/projected_feature_classes'
|