rgeo 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +29 -0
- data/ext/geos_c_impl/Makefile_2.2.3 +260 -0
- data/ext/geos_c_impl/coordinates.c +65 -0
- data/ext/geos_c_impl/coordinates.h +2 -0
- data/ext/geos_c_impl/extconf.rb +19 -43
- data/ext/geos_c_impl/geometry.c +24 -0
- data/ext/geos_c_impl/geometry_collection.c +99 -1
- data/ext/geos_c_impl/geos_c_impl_2.2.3.bundle +0 -0
- data/ext/geos_c_impl/line_string.c +38 -0
- data/ext/geos_c_impl/mkmf.log +123 -0
- data/ext/geos_c_impl/point.c +27 -0
- data/ext/geos_c_impl/polygon.c +26 -0
- data/ext/proj4_c_impl/Makefile_2.2.3 +260 -0
- data/ext/proj4_c_impl/extconf.rb +32 -32
- data/ext/proj4_c_impl/mkmf.log +47 -0
- data/ext/proj4_c_impl/proj4_c_impl_2.2.3.bundle +0 -0
- data/lib/rgeo.rb +10 -11
- data/lib/rgeo/cartesian.rb +7 -12
- data/lib/rgeo/cartesian/analysis.rb +13 -26
- data/lib/rgeo/cartesian/bounding_box.rb +45 -114
- data/lib/rgeo/cartesian/calculations.rb +3 -21
- data/lib/rgeo/cartesian/factory.rb +101 -122
- data/lib/rgeo/cartesian/feature_classes.rb +9 -59
- data/lib/rgeo/cartesian/feature_methods.rb +15 -45
- data/lib/rgeo/cartesian/interface.rb +6 -17
- data/lib/rgeo/coord_sys.rb +9 -15
- data/lib/rgeo/coord_sys/cs/entities.rb +84 -330
- data/lib/rgeo/coord_sys/cs/factories.rb +2 -32
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +52 -80
- data/lib/rgeo/coord_sys/proj4.rb +28 -67
- data/lib/rgeo/coord_sys/proj4_c_impl.bundle +0 -0
- data/lib/rgeo/coord_sys/srs_database/interface.rb +4 -24
- data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +20 -38
- data/lib/rgeo/coord_sys/srs_database/sr_org.rb +6 -22
- data/lib/rgeo/coord_sys/srs_database/url_reader.rb +6 -21
- data/lib/rgeo/error.rb +0 -6
- data/lib/rgeo/feature.rb +18 -23
- data/lib/rgeo/feature/curve.rb +0 -14
- data/lib/rgeo/feature/factory.rb +13 -38
- data/lib/rgeo/feature/factory_generator.rb +4 -16
- data/lib/rgeo/feature/geometry.rb +18 -60
- data/lib/rgeo/feature/geometry_collection.rb +3 -17
- data/lib/rgeo/feature/line.rb +0 -10
- data/lib/rgeo/feature/line_string.rb +1 -13
- data/lib/rgeo/feature/linear_ring.rb +0 -9
- data/lib/rgeo/feature/mixins.rb +11 -36
- data/lib/rgeo/feature/multi_curve.rb +0 -11
- data/lib/rgeo/feature/multi_line_string.rb +0 -9
- data/lib/rgeo/feature/multi_point.rb +0 -9
- data/lib/rgeo/feature/multi_polygon.rb +0 -9
- data/lib/rgeo/feature/multi_surface.rb +0 -12
- data/lib/rgeo/feature/point.rb +0 -13
- data/lib/rgeo/feature/polygon.rb +1 -14
- data/lib/rgeo/feature/surface.rb +0 -12
- data/lib/rgeo/feature/types.rb +19 -61
- data/lib/rgeo/geographic.rb +10 -15
- data/lib/rgeo/geographic/factory.rb +126 -147
- data/lib/rgeo/geographic/interface.rb +67 -81
- data/lib/rgeo/geographic/proj4_projector.rb +13 -37
- data/lib/rgeo/geographic/projected_feature_classes.rb +7 -66
- data/lib/rgeo/geographic/projected_feature_methods.rb +15 -80
- data/lib/rgeo/geographic/projected_window.rb +15 -67
- data/lib/rgeo/geographic/simple_mercator_projector.rb +32 -56
- data/lib/rgeo/geographic/spherical_feature_classes.rb +9 -68
- data/lib/rgeo/geographic/spherical_feature_methods.rb +18 -51
- data/lib/rgeo/geographic/spherical_math.rb +26 -51
- data/lib/rgeo/geos.rb +23 -20
- data/lib/rgeo/geos/capi_factory.rb +125 -131
- data/lib/rgeo/geos/capi_feature_classes.rb +21 -88
- data/lib/rgeo/geos/ffi_factory.rb +90 -143
- data/lib/rgeo/geos/ffi_feature_classes.rb +8 -63
- data/lib/rgeo/geos/ffi_feature_methods.rb +46 -162
- data/lib/rgeo/geos/geos_c_impl.bundle +0 -0
- data/lib/rgeo/geos/interface.rb +4 -23
- data/lib/rgeo/geos/utils.rb +4 -19
- data/lib/rgeo/geos/zm_factory.rb +82 -131
- data/lib/rgeo/geos/zm_feature_classes.rb +8 -63
- data/lib/rgeo/geos/zm_feature_methods.rb +34 -107
- data/lib/rgeo/impl_helper.rb +8 -13
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +27 -71
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +10 -28
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +21 -57
- data/lib/rgeo/impl_helper/basic_point_methods.rb +12 -30
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +9 -28
- data/lib/rgeo/impl_helper/math.rb +4 -10
- data/lib/rgeo/impl_helper/utils.rb +2 -10
- data/lib/rgeo/version.rb +1 -1
- data/lib/rgeo/wkrep.rb +4 -9
- data/lib/rgeo/wkrep/wkb_generator.rb +22 -46
- data/lib/rgeo/wkrep/wkb_parser.rb +25 -52
- data/lib/rgeo/wkrep/wkt_generator.rb +39 -69
- data/lib/rgeo/wkrep/wkt_parser.rb +52 -89
- data/lib/rgeo/yaml.rb +1 -7
- data/test/common/factory_tests.rb +4 -19
- data/test/common/geometry_collection_tests.rb +6 -39
- data/test/common/line_string_tests.rb +10 -39
- data/test/common/multi_line_string_tests.rb +10 -30
- data/test/common/multi_point_tests.rb +15 -34
- data/test/common/multi_polygon_tests.rb +26 -28
- data/test/common/point_tests.rb +37 -59
- data/test/common/polygon_tests.rb +16 -25
- data/test/coord_sys/tc_ogc_cs.rb +151 -186
- data/test/coord_sys/tc_proj4.rb +35 -60
- data/test/coord_sys/tc_proj4_srs_data.rb +15 -24
- data/test/coord_sys/tc_sr_org.rb +11 -19
- data/test/coord_sys/tc_url_reader.rb +13 -23
- data/test/geos_capi/tc_factory.rb +7 -16
- data/test/geos_capi/tc_geometry_collection.rb +6 -14
- data/test/geos_capi/tc_line_string.rb +7 -15
- data/test/geos_capi/tc_misc.rb +26 -41
- data/test/geos_capi/tc_multi_line_string.rb +6 -14
- data/test/geos_capi/tc_multi_point.rb +7 -15
- data/test/geos_capi/tc_multi_polygon.rb +8 -18
- data/test/geos_capi/tc_parsing_unparsing.rb +11 -21
- data/test/geos_capi/tc_point.rb +12 -26
- data/test/geos_capi/tc_polygon.rb +52 -17
- data/test/geos_capi/tc_zmfactory.rb +7 -18
- data/test/geos_ffi/tc_factory.rb +7 -16
- data/test/geos_ffi/tc_geometry_collection.rb +7 -15
- data/test/geos_ffi/tc_line_string.rb +7 -15
- data/test/geos_ffi/tc_misc.rb +8 -18
- data/test/geos_ffi/tc_multi_line_string.rb +7 -15
- data/test/geos_ffi/tc_multi_point.rb +8 -16
- data/test/geos_ffi/tc_multi_polygon.rb +9 -18
- data/test/geos_ffi/tc_parsing_unparsing.rb +14 -24
- data/test/geos_ffi/tc_point.rb +13 -28
- data/test/geos_ffi/tc_polygon.rb +7 -17
- data/test/geos_ffi/tc_zmfactory.rb +8 -19
- data/test/projected_geographic/tc_factory.rb +7 -15
- data/test/projected_geographic/tc_geometry_collection.rb +7 -15
- data/test/projected_geographic/tc_line_string.rb +7 -15
- data/test/projected_geographic/tc_multi_line_string.rb +7 -16
- data/test/projected_geographic/tc_multi_point.rb +8 -17
- data/test/projected_geographic/tc_multi_polygon.rb +8 -16
- data/test/projected_geographic/tc_point.rb +11 -23
- data/test/projected_geographic/tc_polygon.rb +7 -15
- data/test/simple_cartesian/tc_calculations.rb +6 -22
- data/test/simple_cartesian/tc_factory.rb +7 -16
- data/test/simple_cartesian/tc_geometry_collection.rb +6 -15
- data/test/simple_cartesian/tc_line_string.rb +6 -15
- data/test/simple_cartesian/tc_multi_line_string.rb +6 -15
- data/test/simple_cartesian/tc_multi_point.rb +7 -16
- data/test/simple_cartesian/tc_multi_polygon.rb +7 -16
- data/test/simple_cartesian/tc_point.rb +10 -21
- data/test/simple_cartesian/tc_polygon.rb +6 -15
- data/test/simple_mercator/tc_factory.rb +6 -14
- data/test/simple_mercator/tc_geometry_collection.rb +6 -14
- data/test/simple_mercator/tc_line_string.rb +6 -14
- data/test/simple_mercator/tc_multi_line_string.rb +6 -15
- data/test/simple_mercator/tc_multi_point.rb +7 -16
- data/test/simple_mercator/tc_multi_polygon.rb +7 -15
- data/test/simple_mercator/tc_point.rb +11 -24
- data/test/simple_mercator/tc_polygon.rb +6 -14
- data/test/simple_mercator/tc_window.rb +10 -34
- data/test/spherical_geographic/tc_calculations.rb +5 -32
- data/test/spherical_geographic/tc_factory.rb +6 -15
- data/test/spherical_geographic/tc_geometry_collection.rb +6 -15
- data/test/spherical_geographic/tc_line_string.rb +6 -15
- data/test/spherical_geographic/tc_multi_line_string.rb +6 -15
- data/test/spherical_geographic/tc_multi_point.rb +7 -16
- data/test/spherical_geographic/tc_multi_polygon.rb +7 -16
- data/test/spherical_geographic/tc_point.rb +10 -22
- data/test/spherical_geographic/tc_polygon.rb +6 -15
- data/test/tc_cartesian_analysis.rb +4 -16
- data/test/tc_cartesian_bbox.rb +7 -21
- data/test/tc_mixins.rb +8 -25
- data/test/tc_oneoff.rb +5 -13
- data/test/tc_types.rb +7 -16
- data/test/wkrep/tc_wkb_generator.rb +63 -97
- data/test/wkrep/tc_wkb_parser.rb +63 -100
- data/test/wkrep/tc_wkt_generator.rb +54 -92
- data/test/wkrep/tc_wkt_parser.rb +84 -133
- metadata +39 -9
- data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +0 -166
- data/test/coord_sys/tc_active_record_table.rb +0 -79
@@ -5,12 +5,8 @@
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
7
|
module RGeo
|
8
|
-
|
9
8
|
module Geographic
|
10
|
-
|
11
9
|
class << self
|
12
|
-
|
13
|
-
|
14
10
|
# Creates and returns a geographic factory that does not include a
|
15
11
|
# a projection, and which performs calculations assuming a
|
16
12
|
# spherical earth. In other words, geodesics are treated as great
|
@@ -116,7 +112,7 @@ module RGeo
|
|
116
112
|
# Default is the empty hash, indicating the default configuration
|
117
113
|
# for WKRep::WKBGenerator.
|
118
114
|
|
119
|
-
def spherical_factory(opts_={})
|
115
|
+
def spherical_factory(opts_ = {})
|
120
116
|
proj4_ = opts_[:proj4]
|
121
117
|
coord_sys_ = opts_[:coord_sys]
|
122
118
|
srid_ = opts_[:srid]
|
@@ -128,21 +124,20 @@ module RGeo
|
|
128
124
|
end
|
129
125
|
end
|
130
126
|
srid_ ||= coord_sys_.authority_code if coord_sys_
|
131
|
-
Geographic::Factory.new(
|
132
|
-
:
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
138
|
-
:
|
139
|
-
:
|
140
|
-
:
|
141
|
-
:
|
142
|
-
:
|
127
|
+
Geographic::Factory.new("Spherical",
|
128
|
+
has_z_coordinate: opts_[:has_z_coordinate],
|
129
|
+
has_m_coordinate: opts_[:has_m_coordinate],
|
130
|
+
proj4: proj4_ || _proj4_4055,
|
131
|
+
coord_sys: coord_sys_ || _coordsys_4055,
|
132
|
+
uses_lenient_assertions: opts_[:uses_lenient_assertions],
|
133
|
+
buffer_resolution: opts_[:buffer_resolution],
|
134
|
+
wkt_parser: opts_[:wkt_parser],
|
135
|
+
wkb_parser: opts_[:wkb_parser],
|
136
|
+
wkt_generator: opts_[:wkt_generator],
|
137
|
+
wkb_generator: opts_[:wkb_generator],
|
138
|
+
srid: (srid_ || 4055).to_i)
|
143
139
|
end
|
144
140
|
|
145
|
-
|
146
141
|
# Creates and returns a geographic factory that is designed for
|
147
142
|
# visualization applications that use Google or Bing maps, or any
|
148
143
|
# other visualization systems that use the same projection. It
|
@@ -215,28 +210,27 @@ module RGeo
|
|
215
210
|
# <tt>:buffer_resolution</tt> options. See RGeo::Geos.factory for
|
216
211
|
# more details.
|
217
212
|
|
218
|
-
def simple_mercator_factory(opts_={})
|
219
|
-
factory_ = Geographic::Factory.new(
|
220
|
-
:
|
221
|
-
:
|
222
|
-
:
|
223
|
-
:
|
224
|
-
:
|
225
|
-
:
|
226
|
-
:
|
227
|
-
:
|
228
|
-
:
|
213
|
+
def simple_mercator_factory(opts_ = {})
|
214
|
+
factory_ = Geographic::Factory.new("Projected",
|
215
|
+
proj4: _proj4_4326,
|
216
|
+
coord_sys: _coordsys_4326,
|
217
|
+
srid: 4326,
|
218
|
+
wkt_parser: opts_[:wkt_parser],
|
219
|
+
wkb_parser: opts_[:wkb_parser],
|
220
|
+
wkt_generator: opts_[:wkt_generator],
|
221
|
+
wkb_generator: opts_[:wkb_generator],
|
222
|
+
has_z_coordinate: opts_[:has_z_coordinate],
|
223
|
+
has_m_coordinate: opts_[:has_m_coordinate])
|
229
224
|
projector_ = Geographic::SimpleMercatorProjector.new(factory_,
|
230
|
-
:
|
231
|
-
:
|
232
|
-
:
|
233
|
-
:
|
234
|
-
:
|
225
|
+
buffer_resolution: opts_[:buffer_resolution],
|
226
|
+
lenient_multi_polygon_assertions: opts_[:lenient_multi_polygon_assertions],
|
227
|
+
uses_lenient_assertions: opts_[:uses_lenient_assertions],
|
228
|
+
has_z_coordinate: opts_[:has_z_coordinate],
|
229
|
+
has_m_coordinate: opts_[:has_m_coordinate])
|
235
230
|
factory_._set_projector(projector_)
|
236
231
|
factory_
|
237
232
|
end
|
238
233
|
|
239
|
-
|
240
234
|
# Creates and returns a geographic factory that includes a
|
241
235
|
# projection specified by a Proj4 coordinate system. Like all
|
242
236
|
# geographic factories, this one creates features using latitude-
|
@@ -349,7 +343,7 @@ module RGeo
|
|
349
343
|
# <tt>:buffer_resolution</tt> options. See RGeo::Geos.factory for
|
350
344
|
# more details.
|
351
345
|
|
352
|
-
def projected_factory(opts_={})
|
346
|
+
def projected_factory(opts_ = {})
|
353
347
|
unless CoordSys::Proj4.supported?
|
354
348
|
raise Error::UnsupportedOperation, "Proj4 is not supported because the proj4 library was not found at install time."
|
355
349
|
end
|
@@ -358,10 +352,10 @@ module RGeo
|
|
358
352
|
# Get the projection coordinate systems from the given factory
|
359
353
|
projection_proj4_ = projection_factory_.proj4
|
360
354
|
unless projection_proj4_
|
361
|
-
raise ::ArgumentError,
|
355
|
+
raise ::ArgumentError, "The :projection_factory does not have a proj4."
|
362
356
|
end
|
363
357
|
projection_coord_sys_ = projection_factory_.coord_sys
|
364
|
-
if projection_coord_sys_ && !projection_coord_sys_.
|
358
|
+
if projection_coord_sys_ && !projection_coord_sys_.is_a?(CoordSys::CS::ProjectedCoordinateSystem)
|
365
359
|
raise ::ArgumentError, 'The :projection_factory\'s coord_sys is not a ProjectedCoordinateSystem.'
|
366
360
|
end
|
367
361
|
# Determine geographic coordinate system. First check parameters.
|
@@ -382,14 +376,14 @@ module RGeo
|
|
382
376
|
srid_ ||= coord_sys_.authority_code if coord_sys_
|
383
377
|
srid_ ||= 4326
|
384
378
|
# Now we should have all the coordinate system info.
|
385
|
-
factory_ = Geographic::Factory.new(
|
386
|
-
:
|
387
|
-
:
|
388
|
-
:
|
389
|
-
:
|
390
|
-
:
|
391
|
-
:
|
392
|
-
:
|
379
|
+
factory_ = Geographic::Factory.new("Projected",
|
380
|
+
proj4: proj4_,
|
381
|
+
coord_sys: coord_sys_,
|
382
|
+
srid: srid_.to_i,
|
383
|
+
has_z_coordinate: projection_factory_.property(:has_z_coordinate),
|
384
|
+
has_m_coordinate: projection_factory_.property(:has_m_coordinate),
|
385
|
+
wkt_parser: opts_[:wkt_parser], wkt_generator: opts_[:wkt_generator],
|
386
|
+
wkb_parser: opts_[:wkb_parser], wkb_generator: opts_[:wkb_generator])
|
393
387
|
projector_ = Geographic::Proj4Projector.create_from_existing_factory(factory_,
|
394
388
|
projection_factory_)
|
395
389
|
else
|
@@ -407,18 +401,18 @@ module RGeo
|
|
407
401
|
end
|
408
402
|
# A projection proj4 is absolutely required.
|
409
403
|
unless projection_proj4_
|
410
|
-
raise ::ArgumentError,
|
404
|
+
raise ::ArgumentError, "Unable to determine the Proj4 for the projected coordinate system."
|
411
405
|
end
|
412
406
|
# Check the projection coordinate systems, and parse if needed.
|
413
|
-
if projection_proj4_.
|
407
|
+
if projection_proj4_.is_a?(::String) || projection_proj4_.is_a?(::Hash)
|
414
408
|
actual_projection_proj4_ = CoordSys::Proj4.create(projection_proj4_)
|
415
409
|
unless actual_projection_proj4_
|
416
410
|
raise ::ArgumentError, "Bad proj4 syntax: #{projection_proj4_.inspect}"
|
417
411
|
end
|
418
412
|
projection_proj4_ = actual_projection_proj4_
|
419
413
|
end
|
420
|
-
if projection_coord_sys_ && !projection_coord_sys_.
|
421
|
-
raise ::ArgumentError,
|
414
|
+
if projection_coord_sys_ && !projection_coord_sys_.is_a?(CoordSys::CS::ProjectedCoordinateSystem)
|
415
|
+
raise ::ArgumentError, "The :projection_coord_sys is not a ProjectedCoordinateSystem."
|
422
416
|
end
|
423
417
|
projection_srid_ ||= projection_coord_sys_.authority_code if projection_coord_sys_
|
424
418
|
# Determine geographic coordinate system. First check parameters.
|
@@ -439,65 +433,57 @@ module RGeo
|
|
439
433
|
srid_ ||= coord_sys_.authority_code if coord_sys_
|
440
434
|
srid_ ||= 4326
|
441
435
|
# Now we should have all the coordinate system info.
|
442
|
-
factory_ = Geographic::Factory.new(
|
443
|
-
:
|
444
|
-
:
|
445
|
-
:
|
446
|
-
:
|
447
|
-
:
|
448
|
-
:
|
449
|
-
:
|
436
|
+
factory_ = Geographic::Factory.new("Projected",
|
437
|
+
proj4: proj4_,
|
438
|
+
coord_sys: coord_sys_,
|
439
|
+
srid: srid_.to_i,
|
440
|
+
has_z_coordinate: opts_[:has_z_coordinate],
|
441
|
+
has_m_coordinate: opts_[:has_m_coordinate],
|
442
|
+
wkt_parser: opts_[:wkt_parser], wkt_generator: opts_[:wkt_generator],
|
443
|
+
wkb_parser: opts_[:wkb_parser], wkb_generator: opts_[:wkb_generator])
|
450
444
|
projector_ = Geographic::Proj4Projector.create_from_proj4(factory_,
|
451
445
|
projection_proj4_,
|
452
|
-
:
|
453
|
-
:
|
454
|
-
:
|
455
|
-
:
|
456
|
-
:
|
457
|
-
:
|
458
|
-
:
|
459
|
-
:
|
460
|
-
:
|
446
|
+
srid: projection_srid_,
|
447
|
+
coord_sys: projection_coord_sys_,
|
448
|
+
buffer_resolution: opts_[:buffer_resolution],
|
449
|
+
lenient_multi_polygon_assertions: opts_[:lenient_multi_polygon_assertions],
|
450
|
+
uses_lenient_assertions: opts_[:uses_lenient_assertions],
|
451
|
+
has_z_coordinate: opts_[:has_z_coordinate],
|
452
|
+
has_m_coordinate: opts_[:has_m_coordinate],
|
453
|
+
wkt_parser: opts_[:wkt_parser], wkt_generator: opts_[:wkt_generator],
|
454
|
+
wkb_parser: opts_[:wkb_parser], wkb_generator: opts_[:wkb_generator])
|
461
455
|
end
|
462
456
|
factory_._set_projector(projector_)
|
463
457
|
factory_
|
464
458
|
end
|
465
459
|
|
466
|
-
|
467
|
-
def _proj4_4055 # :nodoc:
|
460
|
+
def _proj4_4055 # :nodoc:
|
468
461
|
unless defined?(@proj4_4055)
|
469
|
-
@proj4_4055 = CoordSys::Proj4.create(
|
462
|
+
@proj4_4055 = CoordSys::Proj4.create("+proj=longlat +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +no_defs")
|
470
463
|
end
|
471
464
|
@proj4_4055
|
472
465
|
end
|
473
466
|
|
474
|
-
|
475
|
-
def _coordsys_4055 # :nodoc:
|
467
|
+
def _coordsys_4055 # :nodoc:
|
476
468
|
unless defined?(@coordsys_4055)
|
477
469
|
@coordsys_4055 = CoordSys::CS.create_from_wkt('GEOGCS["Popular Visualisation CRS",DATUM["Popular_Visualisation_Datum",SPHEROID["Popular Visualisation Sphere",6378137,0,AUTHORITY["EPSG","7059"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6055"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4055"]]')
|
478
470
|
end
|
479
471
|
@coordsys_4055
|
480
472
|
end
|
481
473
|
|
482
|
-
|
483
|
-
def _proj4_4326 # :nodoc:
|
474
|
+
def _proj4_4326 # :nodoc:
|
484
475
|
unless defined?(@proj4_4326)
|
485
|
-
@proj4_4326 = CoordSys::Proj4.create(
|
476
|
+
@proj4_4326 = CoordSys::Proj4.create("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
|
486
477
|
end
|
487
478
|
@proj4_4326
|
488
479
|
end
|
489
480
|
|
490
|
-
|
491
|
-
def _coordsys_4326 # :nodoc:
|
481
|
+
def _coordsys_4326 # :nodoc:
|
492
482
|
unless defined?(@coordsys_4326)
|
493
483
|
@coordsys_4326 = CoordSys::CS.create_from_wkt('GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]')
|
494
484
|
end
|
495
485
|
@coordsys_4326
|
496
486
|
end
|
497
|
-
|
498
|
-
|
499
487
|
end
|
500
|
-
|
501
488
|
end
|
502
|
-
|
503
489
|
end
|
@@ -5,78 +5,54 @@
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
7
|
module RGeo
|
8
|
-
|
9
8
|
module Geographic
|
10
|
-
|
11
|
-
|
12
|
-
class Proj4Projector # :nodoc:
|
13
|
-
|
14
|
-
|
9
|
+
class Proj4Projector # :nodoc:
|
15
10
|
def initialize(geography_factory_, projection_factory_)
|
16
11
|
@geography_factory = geography_factory_
|
17
12
|
@projection_factory = projection_factory_
|
18
13
|
end
|
19
14
|
|
20
|
-
|
21
|
-
def _set_factories(geography_factory_, projection_factory_) # :nodoc:
|
15
|
+
def _set_factories(geography_factory_, projection_factory_) # :nodoc:
|
22
16
|
@geography_factory = geography_factory_
|
23
17
|
@projection_factory = projection_factory_
|
24
18
|
end
|
25
19
|
|
26
|
-
|
27
20
|
def project(geometry_)
|
28
21
|
Feature.cast(geometry_, @projection_factory, :project)
|
29
22
|
end
|
30
23
|
|
31
|
-
|
32
24
|
def unproject(geometry_)
|
33
25
|
Feature.cast(geometry_, @geography_factory, :project)
|
34
26
|
end
|
35
27
|
|
36
|
-
|
37
|
-
def projection_factory
|
38
|
-
@projection_factory
|
39
|
-
end
|
40
|
-
|
28
|
+
attr_reader :projection_factory
|
41
29
|
|
42
30
|
def wraps?
|
43
31
|
false
|
44
32
|
end
|
45
33
|
|
46
|
-
|
47
34
|
def limits_window
|
48
35
|
nil
|
49
36
|
end
|
50
37
|
|
51
|
-
|
52
38
|
class << self
|
53
|
-
|
54
|
-
|
55
39
|
def create_from_existing_factory(geography_factory_, projection_factory_)
|
56
40
|
new(geography_factory_, projection_factory_)
|
57
41
|
end
|
58
42
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
:wkb_parser => opts_[:wkb_parser], :wkb_generator => opts_[:wkb_generator])
|
43
|
+
def create_from_proj4(geography_factory_, proj4_, opts_ = {})
|
44
|
+
projection_factory_ = Cartesian.preferred_factory(proj4: proj4_,
|
45
|
+
coord_sys: opts_[:coord_sys], srid: opts_[:srid],
|
46
|
+
buffer_resolution: opts_[:buffer_resolution],
|
47
|
+
lenient_multi_polygon_assertions: opts_[:lenient_multi_polygon_assertions],
|
48
|
+
uses_lenient_assertions: opts_[:uses_lenient_assertions],
|
49
|
+
has_z_coordinate: opts_[:has_z_coordinate],
|
50
|
+
has_m_coordinate: opts_[:has_m_coordinate],
|
51
|
+
wkt_parser: opts_[:wkt_parser], wkt_generator: opts_[:wkt_generator],
|
52
|
+
wkb_parser: opts_[:wkb_parser], wkb_generator: opts_[:wkb_generator])
|
70
53
|
new(geography_factory_, projection_factory_)
|
71
54
|
end
|
72
|
-
|
73
|
-
|
74
55
|
end
|
75
|
-
|
76
|
-
|
77
56
|
end
|
78
|
-
|
79
|
-
|
80
57
|
end
|
81
|
-
|
82
58
|
end
|
@@ -5,29 +5,18 @@
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
7
|
module RGeo
|
8
|
-
|
9
8
|
module Geographic
|
10
|
-
|
11
|
-
|
12
|
-
class ProjectedPointImpl # :nodoc:
|
13
|
-
|
14
|
-
|
9
|
+
class ProjectedPointImpl # :nodoc:
|
15
10
|
include Feature::Point
|
16
11
|
include ImplHelper::BasicGeometryMethods
|
17
12
|
include ImplHelper::BasicPointMethods
|
18
13
|
include ProjectedGeometryMethods
|
19
14
|
include ProjectedPointMethods
|
20
15
|
|
21
|
-
|
22
16
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Point).include_in_class(self, true)
|
23
|
-
|
24
|
-
|
25
17
|
end
|
26
18
|
|
27
|
-
|
28
19
|
class ProjectedLineStringImpl # :nodoc:
|
29
|
-
|
30
|
-
|
31
20
|
include Feature::LineString
|
32
21
|
include ImplHelper::BasicGeometryMethods
|
33
22
|
include ImplHelper::BasicLineStringMethods
|
@@ -35,16 +24,10 @@ module RGeo
|
|
35
24
|
include ProjectedNCurveMethods
|
36
25
|
include ProjectedLineStringMethods
|
37
26
|
|
38
|
-
|
39
27
|
Feature::MixinCollection::GLOBAL.for_type(Feature::LineString).include_in_class(self, true)
|
40
|
-
|
41
|
-
|
42
28
|
end
|
43
29
|
|
44
|
-
|
45
30
|
class ProjectedLinearRingImpl # :nodoc:
|
46
|
-
|
47
|
-
|
48
31
|
include Feature::LinearRing
|
49
32
|
include ImplHelper::BasicGeometryMethods
|
50
33
|
include ImplHelper::BasicLineStringMethods
|
@@ -53,16 +36,10 @@ module RGeo
|
|
53
36
|
include ProjectedNCurveMethods
|
54
37
|
include ProjectedLineStringMethods
|
55
38
|
|
56
|
-
|
57
39
|
Feature::MixinCollection::GLOBAL.for_type(Feature::LinearRing).include_in_class(self, true)
|
58
|
-
|
59
|
-
|
60
40
|
end
|
61
41
|
|
62
|
-
|
63
|
-
class ProjectedLineImpl # :nodoc:
|
64
|
-
|
65
|
-
|
42
|
+
class ProjectedLineImpl # :nodoc:
|
66
43
|
include Feature::Line
|
67
44
|
include ImplHelper::BasicGeometryMethods
|
68
45
|
include ImplHelper::BasicLineStringMethods
|
@@ -71,16 +48,10 @@ module RGeo
|
|
71
48
|
include ProjectedNCurveMethods
|
72
49
|
include ProjectedLineStringMethods
|
73
50
|
|
74
|
-
|
75
51
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Line).include_in_class(self, true)
|
76
|
-
|
77
|
-
|
78
52
|
end
|
79
53
|
|
80
|
-
|
81
|
-
class ProjectedPolygonImpl # :nodoc:
|
82
|
-
|
83
|
-
|
54
|
+
class ProjectedPolygonImpl # :nodoc:
|
84
55
|
include Feature::Polygon
|
85
56
|
include ImplHelper::BasicGeometryMethods
|
86
57
|
include ImplHelper::BasicPolygonMethods
|
@@ -88,47 +59,29 @@ module RGeo
|
|
88
59
|
include ProjectedNSurfaceMethods
|
89
60
|
include ProjectedPolygonMethods
|
90
61
|
|
91
|
-
|
92
62
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Polygon).include_in_class(self, true)
|
93
|
-
|
94
|
-
|
95
63
|
end
|
96
64
|
|
97
|
-
|
98
|
-
class ProjectedGeometryCollectionImpl # :nodoc:
|
99
|
-
|
100
|
-
|
65
|
+
class ProjectedGeometryCollectionImpl # :nodoc:
|
101
66
|
include Feature::GeometryCollection
|
102
67
|
include ImplHelper::BasicGeometryMethods
|
103
68
|
include ImplHelper::BasicGeometryCollectionMethods
|
104
69
|
include ProjectedGeometryMethods
|
105
70
|
|
106
|
-
|
107
71
|
Feature::MixinCollection::GLOBAL.for_type(Feature::GeometryCollection).include_in_class(self, true)
|
108
|
-
|
109
|
-
|
110
72
|
end
|
111
73
|
|
112
|
-
|
113
|
-
class ProjectedMultiPointImpl # :nodoc:
|
114
|
-
|
115
|
-
|
74
|
+
class ProjectedMultiPointImpl # :nodoc:
|
116
75
|
include Feature::MultiPoint
|
117
76
|
include ImplHelper::BasicGeometryMethods
|
118
77
|
include ImplHelper::BasicGeometryCollectionMethods
|
119
78
|
include ImplHelper::BasicMultiPointMethods
|
120
79
|
include ProjectedGeometryMethods
|
121
80
|
|
122
|
-
|
123
81
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiPoint).include_in_class(self, true)
|
124
|
-
|
125
|
-
|
126
82
|
end
|
127
83
|
|
128
|
-
|
129
|
-
class ProjectedMultiLineStringImpl # :nodoc:
|
130
|
-
|
131
|
-
|
84
|
+
class ProjectedMultiLineStringImpl # :nodoc:
|
132
85
|
include Feature::MultiLineString
|
133
86
|
include ImplHelper::BasicGeometryMethods
|
134
87
|
include ImplHelper::BasicGeometryCollectionMethods
|
@@ -136,16 +89,10 @@ module RGeo
|
|
136
89
|
include ProjectedGeometryMethods
|
137
90
|
include ProjectedNCurveMethods
|
138
91
|
|
139
|
-
|
140
92
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiLineString).include_in_class(self, true)
|
141
|
-
|
142
|
-
|
143
93
|
end
|
144
94
|
|
145
|
-
|
146
|
-
class ProjectedMultiPolygonImpl # :nodoc:
|
147
|
-
|
148
|
-
|
95
|
+
class ProjectedMultiPolygonImpl # :nodoc:
|
149
96
|
include Feature::MultiPolygon
|
150
97
|
include ImplHelper::BasicGeometryMethods
|
151
98
|
include ImplHelper::BasicGeometryCollectionMethods
|
@@ -154,13 +101,7 @@ module RGeo
|
|
154
101
|
include ProjectedNSurfaceMethods
|
155
102
|
include ProjectedMultiPolygonMethods
|
156
103
|
|
157
|
-
|
158
104
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiPolygon).include_in_class(self, true)
|
159
|
-
|
160
|
-
|
161
105
|
end
|
162
|
-
|
163
|
-
|
164
106
|
end
|
165
|
-
|
166
107
|
end
|