rgeo 0.3.20 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +7 -0
  2. data/ext/geos_c_impl/extconf.rb +0 -30
  3. data/ext/geos_c_impl/factory.c +0 -32
  4. data/ext/geos_c_impl/factory.h +0 -33
  5. data/ext/geos_c_impl/geometry.c +20 -33
  6. data/ext/geos_c_impl/geometry.h +0 -32
  7. data/ext/geos_c_impl/geometry_collection.c +0 -32
  8. data/ext/geos_c_impl/geometry_collection.h +0 -32
  9. data/ext/geos_c_impl/line_string.c +0 -32
  10. data/ext/geos_c_impl/line_string.h +0 -32
  11. data/ext/geos_c_impl/main.c +0 -32
  12. data/ext/geos_c_impl/point.c +0 -33
  13. data/ext/geos_c_impl/point.h +0 -32
  14. data/ext/geos_c_impl/polygon.c +0 -32
  15. data/ext/geos_c_impl/polygon.h +0 -32
  16. data/ext/geos_c_impl/preface.h +0 -32
  17. data/ext/proj4_c_impl/extconf.rb +0 -30
  18. data/ext/proj4_c_impl/main.c +0 -33
  19. data/lib/rgeo.rb +0 -36
  20. data/lib/rgeo/cartesian.rb +0 -30
  21. data/lib/rgeo/cartesian/analysis.rb +0 -30
  22. data/lib/rgeo/cartesian/bounding_box.rb +0 -30
  23. data/lib/rgeo/cartesian/calculations.rb +0 -30
  24. data/lib/rgeo/cartesian/factory.rb +0 -30
  25. data/lib/rgeo/cartesian/feature_classes.rb +0 -30
  26. data/lib/rgeo/cartesian/feature_methods.rb +0 -30
  27. data/lib/rgeo/cartesian/interface.rb +0 -30
  28. data/lib/rgeo/coord_sys.rb +0 -30
  29. data/lib/rgeo/coord_sys/cs/entities.rb +0 -30
  30. data/lib/rgeo/coord_sys/cs/factories.rb +0 -30
  31. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +0 -30
  32. data/lib/rgeo/coord_sys/proj4.rb +1 -49
  33. data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +0 -30
  34. data/lib/rgeo/coord_sys/srs_database/interface.rb +0 -30
  35. data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +0 -30
  36. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +0 -30
  37. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +0 -30
  38. data/lib/rgeo/error.rb +0 -30
  39. data/lib/rgeo/feature.rb +0 -30
  40. data/lib/rgeo/feature/curve.rb +0 -30
  41. data/lib/rgeo/feature/factory.rb +0 -30
  42. data/lib/rgeo/feature/factory_generator.rb +0 -30
  43. data/lib/rgeo/feature/geometry.rb +1 -31
  44. data/lib/rgeo/feature/geometry_collection.rb +0 -30
  45. data/lib/rgeo/feature/line.rb +0 -30
  46. data/lib/rgeo/feature/line_string.rb +0 -30
  47. data/lib/rgeo/feature/linear_ring.rb +0 -30
  48. data/lib/rgeo/feature/mixins.rb +0 -30
  49. data/lib/rgeo/feature/multi_curve.rb +0 -30
  50. data/lib/rgeo/feature/multi_line_string.rb +0 -30
  51. data/lib/rgeo/feature/multi_point.rb +0 -30
  52. data/lib/rgeo/feature/multi_polygon.rb +0 -30
  53. data/lib/rgeo/feature/multi_surface.rb +0 -30
  54. data/lib/rgeo/feature/point.rb +0 -30
  55. data/lib/rgeo/feature/polygon.rb +0 -30
  56. data/lib/rgeo/feature/surface.rb +0 -30
  57. data/lib/rgeo/feature/types.rb +0 -30
  58. data/lib/rgeo/geographic.rb +0 -30
  59. data/lib/rgeo/geographic/factory.rb +0 -30
  60. data/lib/rgeo/geographic/interface.rb +2 -32
  61. data/lib/rgeo/geographic/proj4_projector.rb +0 -30
  62. data/lib/rgeo/geographic/projected_feature_classes.rb +0 -30
  63. data/lib/rgeo/geographic/projected_feature_methods.rb +7 -32
  64. data/lib/rgeo/geographic/projected_window.rb +5 -39
  65. data/lib/rgeo/geographic/simple_mercator_projector.rb +11 -41
  66. data/lib/rgeo/geographic/spherical_feature_classes.rb +0 -30
  67. data/lib/rgeo/geographic/spherical_feature_methods.rb +2 -32
  68. data/lib/rgeo/geographic/spherical_math.rb +0 -30
  69. data/lib/rgeo/geos.rb +0 -30
  70. data/lib/rgeo/geos/capi_factory.rb +8 -38
  71. data/lib/rgeo/geos/capi_feature_classes.rb +0 -29
  72. data/lib/rgeo/geos/ffi_factory.rb +0 -30
  73. data/lib/rgeo/geos/ffi_feature_classes.rb +0 -30
  74. data/lib/rgeo/geos/ffi_feature_methods.rb +0 -30
  75. data/lib/rgeo/geos/interface.rb +5 -49
  76. data/lib/rgeo/geos/utils.rb +0 -30
  77. data/lib/rgeo/geos/zm_factory.rb +0 -30
  78. data/lib/rgeo/geos/zm_feature_classes.rb +0 -30
  79. data/lib/rgeo/geos/zm_feature_methods.rb +0 -30
  80. data/lib/rgeo/impl_helper.rb +0 -30
  81. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +0 -30
  82. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +0 -30
  83. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +0 -30
  84. data/lib/rgeo/impl_helper/basic_point_methods.rb +0 -30
  85. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +0 -30
  86. data/lib/rgeo/impl_helper/math.rb +0 -30
  87. data/lib/rgeo/impl_helper/utils.rb +0 -30
  88. data/lib/rgeo/version.rb +1 -50
  89. data/lib/rgeo/wkrep.rb +0 -30
  90. data/lib/rgeo/wkrep/wkb_generator.rb +0 -30
  91. data/lib/rgeo/wkrep/wkb_parser.rb +0 -30
  92. data/lib/rgeo/wkrep/wkt_generator.rb +0 -30
  93. data/lib/rgeo/wkrep/wkt_parser.rb +0 -30
  94. data/lib/rgeo/yaml.rb +0 -30
  95. data/test/common/factory_tests.rb +0 -30
  96. data/test/common/geometry_collection_tests.rb +0 -30
  97. data/test/common/line_string_tests.rb +0 -30
  98. data/test/common/multi_line_string_tests.rb +0 -30
  99. data/test/common/multi_point_tests.rb +0 -30
  100. data/test/common/multi_polygon_tests.rb +0 -30
  101. data/test/common/point_tests.rb +0 -30
  102. data/test/common/polygon_tests.rb +0 -30
  103. data/test/coord_sys/tc_active_record_table.rb +2 -32
  104. data/test/coord_sys/tc_ogc_cs.rb +0 -30
  105. data/test/coord_sys/tc_proj4.rb +1 -31
  106. data/test/coord_sys/tc_proj4_srs_data.rb +3 -33
  107. data/test/coord_sys/tc_sr_org.rb +2 -32
  108. data/test/coord_sys/tc_url_reader.rb +4 -34
  109. data/test/geos_capi/tc_factory.rb +0 -30
  110. data/test/geos_capi/tc_geometry_collection.rb +0 -30
  111. data/test/geos_capi/tc_line_string.rb +0 -30
  112. data/test/geos_capi/tc_misc.rb +37 -31
  113. data/test/geos_capi/tc_multi_line_string.rb +0 -30
  114. data/test/geos_capi/tc_multi_point.rb +0 -30
  115. data/test/geos_capi/tc_multi_polygon.rb +0 -30
  116. data/test/geos_capi/tc_parsing_unparsing.rb +0 -30
  117. data/test/geos_capi/tc_point.rb +0 -30
  118. data/test/geos_capi/tc_polygon.rb +12 -30
  119. data/test/geos_capi/tc_zmfactory.rb +0 -30
  120. data/test/geos_ffi/tc_factory.rb +0 -30
  121. data/test/geos_ffi/tc_geometry_collection.rb +0 -30
  122. data/test/geos_ffi/tc_line_string.rb +0 -30
  123. data/test/geos_ffi/tc_misc.rb +0 -30
  124. data/test/geos_ffi/tc_multi_line_string.rb +0 -30
  125. data/test/geos_ffi/tc_multi_point.rb +0 -30
  126. data/test/geos_ffi/tc_multi_polygon.rb +0 -30
  127. data/test/geos_ffi/tc_parsing_unparsing.rb +0 -30
  128. data/test/geos_ffi/tc_point.rb +0 -30
  129. data/test/geos_ffi/tc_polygon.rb +0 -30
  130. data/test/geos_ffi/tc_zmfactory.rb +0 -30
  131. data/test/projected_geographic/tc_factory.rb +0 -30
  132. data/test/projected_geographic/tc_geometry_collection.rb +0 -30
  133. data/test/projected_geographic/tc_line_string.rb +0 -30
  134. data/test/projected_geographic/tc_multi_line_string.rb +0 -30
  135. data/test/projected_geographic/tc_multi_point.rb +0 -30
  136. data/test/projected_geographic/tc_multi_polygon.rb +0 -30
  137. data/test/projected_geographic/tc_point.rb +0 -30
  138. data/test/projected_geographic/tc_polygon.rb +0 -30
  139. data/test/simple_cartesian/tc_calculations.rb +0 -30
  140. data/test/simple_cartesian/tc_factory.rb +0 -30
  141. data/test/simple_cartesian/tc_geometry_collection.rb +0 -30
  142. data/test/simple_cartesian/tc_line_string.rb +0 -30
  143. data/test/simple_cartesian/tc_multi_line_string.rb +0 -30
  144. data/test/simple_cartesian/tc_multi_point.rb +0 -30
  145. data/test/simple_cartesian/tc_multi_polygon.rb +0 -30
  146. data/test/simple_cartesian/tc_point.rb +0 -30
  147. data/test/simple_cartesian/tc_polygon.rb +0 -30
  148. data/test/simple_mercator/tc_factory.rb +0 -30
  149. data/test/simple_mercator/tc_geometry_collection.rb +0 -30
  150. data/test/simple_mercator/tc_line_string.rb +0 -30
  151. data/test/simple_mercator/tc_multi_line_string.rb +0 -30
  152. data/test/simple_mercator/tc_multi_point.rb +0 -30
  153. data/test/simple_mercator/tc_multi_polygon.rb +0 -30
  154. data/test/simple_mercator/tc_point.rb +0 -30
  155. data/test/simple_mercator/tc_polygon.rb +0 -30
  156. data/test/simple_mercator/tc_window.rb +8 -30
  157. data/test/spherical_geographic/tc_calculations.rb +0 -30
  158. data/test/spherical_geographic/tc_factory.rb +0 -30
  159. data/test/spherical_geographic/tc_geometry_collection.rb +0 -30
  160. data/test/spherical_geographic/tc_line_string.rb +0 -30
  161. data/test/spherical_geographic/tc_multi_line_string.rb +0 -30
  162. data/test/spherical_geographic/tc_multi_point.rb +0 -30
  163. data/test/spherical_geographic/tc_multi_polygon.rb +0 -30
  164. data/test/spherical_geographic/tc_point.rb +11 -30
  165. data/test/spherical_geographic/tc_polygon.rb +0 -30
  166. data/test/tc_cartesian_analysis.rb +0 -30
  167. data/test/tc_cartesian_bbox.rb +0 -30
  168. data/test/tc_mixins.rb +0 -30
  169. data/test/tc_oneoff.rb +0 -30
  170. data/test/tc_types.rb +0 -30
  171. data/test/wkrep/tc_wkb_generator.rb +0 -30
  172. data/test/wkrep/tc_wkb_parser.rb +0 -30
  173. data/test/wkrep/tc_wkt_generator.rb +0 -30
  174. data/test/wkrep/tc_wkt_parser.rb +0 -30
  175. metadata +94 -47
  176. data/History.rdoc +0 -351
  177. data/README.rdoc +0 -184
  178. data/Spatial_Programming_With_RGeo.rdoc +0 -451
  179. data/Version +0 -1
@@ -3,36 +3,6 @@
3
3
  # Proj4 projection
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010-2012 Daniel Azuma
7
- #
8
- # All rights reserved.
9
- #
10
- # Redistribution and use in source and binary forms, with or without
11
- # modification, are permitted provided that the following conditions are met:
12
- #
13
- # * Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the following disclaimer.
15
- # * Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the following disclaimer in the documentation
17
- # and/or other materials provided with the distribution.
18
- # * Neither the name of the copyright holder, nor the names of any other
19
- # contributors to this software, may be used to endorse or promote products
20
- # derived from this software without specific prior written permission.
21
- #
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- # POSSIBILITY OF SUCH DAMAGE.
33
- # -----------------------------------------------------------------------------
34
- ;
35
-
36
6
 
37
7
  module RGeo
38
8
 
@@ -3,36 +3,6 @@
3
3
  # Projtected geographic feature classes
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010-2012 Daniel Azuma
7
- #
8
- # All rights reserved.
9
- #
10
- # Redistribution and use in source and binary forms, with or without
11
- # modification, are permitted provided that the following conditions are met:
12
- #
13
- # * Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the following disclaimer.
15
- # * Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the following disclaimer in the documentation
17
- # and/or other materials provided with the distribution.
18
- # * Neither the name of the copyright holder, nor the names of any other
19
- # contributors to this software, may be used to endorse or promote products
20
- # derived from this software without specific prior written permission.
21
- #
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- # POSSIBILITY OF SUCH DAMAGE.
33
- # -----------------------------------------------------------------------------
34
- ;
35
-
36
6
 
37
7
  module RGeo
38
8
 
@@ -3,36 +3,6 @@
3
3
  # Projected geographic common method definitions
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010-2012 Daniel Azuma
7
- #
8
- # All rights reserved.
9
- #
10
- # Redistribution and use in source and binary forms, with or without
11
- # modification, are permitted provided that the following conditions are met:
12
- #
13
- # * Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the following disclaimer.
15
- # * Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the following disclaimer in the documentation
17
- # and/or other materials provided with the distribution.
18
- # * Neither the name of the copyright holder, nor the names of any other
19
- # contributors to this software, may be used to endorse or promote products
20
- # derived from this software without specific prior written permission.
21
- #
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- # POSSIBILITY OF SUCH DAMAGE.
33
- # -----------------------------------------------------------------------------
34
- ;
35
-
36
6
 
37
7
  module RGeo
38
8
 
@@ -129,7 +99,12 @@ module RGeo
129
99
  def buffer(distance_)
130
100
  factory.unproject(projection.buffer(distance_))
131
101
  end
132
-
102
+
103
+
104
+ def simplify(tolerance_)
105
+ factory.unproject(projection.simplify(tolerance_))
106
+ end
107
+
133
108
 
134
109
  def convex_hull
135
110
  factory.unproject(projection.convex_hull)
@@ -171,7 +146,7 @@ module RGeo
171
146
 
172
147
  def canonical_x
173
148
  x_ = @x % 360.0
174
- x_ -= 360.0 if x_ >= 180.0
149
+ x_ -= 360.0 if x_ > 180.0
175
150
  x_
176
151
  end
177
152
  alias_method :canonical_longitude, :canonical_x
@@ -3,36 +3,6 @@
3
3
  # A projected window in a geography implementation
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010-2012 Daniel Azuma
7
- #
8
- # All rights reserved.
9
- #
10
- # Redistribution and use in source and binary forms, with or without
11
- # modification, are permitted provided that the following conditions are met:
12
- #
13
- # * Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the following disclaimer.
15
- # * Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the following disclaimer in the documentation
17
- # and/or other materials provided with the distribution.
18
- # * Neither the name of the copyright holder, nor the names of any other
19
- # contributors to this software, may be used to endorse or promote products
20
- # derived from this software without specific prior written permission.
21
- #
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- # POSSIBILITY OF SUCH DAMAGE.
33
- # -----------------------------------------------------------------------------
34
- ;
35
-
36
6
 
37
7
  module RGeo
38
8
 
@@ -240,18 +210,14 @@ module RGeo
240
210
  end
241
211
 
242
212
 
243
- # Returns a random point the rectangle in _unprojected_
213
+ # Returns a random point inside the rectangle in _unprojected_
244
214
  # (lat/lng) space, as a Feature::Point object.
245
215
 
246
216
  def random_point
247
- y_ = @y_min + (@y_max - @y_min) * rand
248
- if @x_min > @x_max
249
- x_ = @x_min + x_span * rand
250
- limits_ = @factory.projection_limits_window
251
- x_ -= limits_.x_span if x_ >= limits_.x_max
252
- else
253
- x_ = (@x_min + @x_max) * rand
254
- end
217
+ y_ = @y_min + y_span * rand
218
+ x_ = @x_min + x_span * rand
219
+ limits_ = @factory.projection_limits_window
220
+ x_ -= limits_.x_span if x_ >= limits_.x_max
255
221
  @factory.unproject(@factory.projection_factory.point(x_, y_))
256
222
  end
257
223
 
@@ -3,36 +3,6 @@
3
3
  # Simple mercator projection
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010-2012 Daniel Azuma
7
- #
8
- # All rights reserved.
9
- #
10
- # Redistribution and use in source and binary forms, with or without
11
- # modification, are permitted provided that the following conditions are met:
12
- #
13
- # * Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the following disclaimer.
15
- # * Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the following disclaimer in the documentation
17
- # and/or other materials provided with the distribution.
18
- # * Neither the name of the copyright holder, nor the names of any other
19
- # contributors to this software, may be used to endorse or promote products
20
- # derived from this software without specific prior written permission.
21
- #
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- # POSSIBILITY OF SUCH DAMAGE.
33
- # -----------------------------------------------------------------------------
34
- ;
35
-
36
6
 
37
7
  module RGeo
38
8
 
@@ -46,9 +16,9 @@ module RGeo
46
16
 
47
17
  def initialize(geography_factory_, opts_={})
48
18
  @geography_factory = geography_factory_
49
- @projection_factory = Cartesian.preferred_factory(:srid => 3785,
50
- :proj4 => SimpleMercatorProjector._proj4_3785,
51
- :coord_sys => SimpleMercatorProjector._coordsys_3785,
19
+ @projection_factory = Cartesian.preferred_factory(:srid => 3857,
20
+ :proj4 => SimpleMercatorProjector._proj4_3857,
21
+ :coord_sys => SimpleMercatorProjector._coordsys_3857,
52
22
  :buffer_resolution => opts_[:buffer_resolution],
53
23
  :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions],
54
24
  :uses_lenient_assertions => opts_[:uses_lenient_assertions],
@@ -140,19 +110,19 @@ module RGeo
140
110
  end
141
111
 
142
112
 
143
- def self._proj4_3785 # :nodoc:
144
- unless defined?(@proj4_3785)
145
- @proj4_3785 = CoordSys::Proj4.create('+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs')
113
+ def self._proj4_3857 # :nodoc:
114
+ unless defined?(@proj4_3857)
115
+ @proj4_3857 = CoordSys::Proj4.create('+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs')
146
116
  end
147
- @proj4_3785
117
+ @proj4_3857
148
118
  end
149
119
 
150
120
 
151
- def self._coordsys_3785 # :nodoc:
152
- unless defined?(@coordsys_3785)
153
- @coordsys_3785 = CoordSys::CS.create_from_wkt('PROJCS["Popular Visualisation CRS / Mercator",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"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],AUTHORITY["EPSG","3785"],AXIS["X",EAST],AXIS["Y",NORTH]]')
121
+ def self._coordsys_3857 # :nodoc:
122
+ unless defined?(@coordsys_3857)
123
+ @coordsys_3857 = CoordSys::CS.create_from_wkt('PROJCS["Popular Visualisation CRS / Mercator",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"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],AUTHORITY["EPSG","3785"],AXIS["X",EAST],AXIS["Y",NORTH]]')
154
124
  end
155
- @coordsys_3785
125
+ @coordsys_3857
156
126
  end
157
127
 
158
128
 
@@ -3,36 +3,6 @@
3
3
  # Spherical geographic feature classes
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010-2012 Daniel Azuma
7
- #
8
- # All rights reserved.
9
- #
10
- # Redistribution and use in source and binary forms, with or without
11
- # modification, are permitted provided that the following conditions are met:
12
- #
13
- # * Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the following disclaimer.
15
- # * Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the following disclaimer in the documentation
17
- # and/or other materials provided with the distribution.
18
- # * Neither the name of the copyright holder, nor the names of any other
19
- # contributors to this software, may be used to endorse or promote products
20
- # derived from this software without specific prior written permission.
21
- #
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- # POSSIBILITY OF SUCH DAMAGE.
33
- # -----------------------------------------------------------------------------
34
- ;
35
-
36
6
 
37
7
  module RGeo
38
8
 
@@ -3,36 +3,6 @@
3
3
  # Spherical geographic common methods
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010-2012 Daniel Azuma
7
- #
8
- # All rights reserved.
9
- #
10
- # Redistribution and use in source and binary forms, with or without
11
- # modification, are permitted provided that the following conditions are met:
12
- #
13
- # * Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the following disclaimer.
15
- # * Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the following disclaimer in the documentation
17
- # and/or other materials provided with the distribution.
18
- # * Neither the name of the copyright holder, nor the names of any other
19
- # contributors to this software, may be used to endorse or promote products
20
- # derived from this software without specific prior written permission.
21
- #
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- # POSSIBILITY OF SUCH DAMAGE.
33
- # -----------------------------------------------------------------------------
34
- ;
35
-
36
6
 
37
7
  module RGeo
38
8
 
@@ -54,9 +24,9 @@ module RGeo
54
24
 
55
25
 
56
26
  def _validate_geometry
57
- if @x < -180.0 || @x >= 180.0
27
+ if @x < -180.0 || @x > 180.0
58
28
  @x = @x % 360.0
59
- @x -= 360.0 if @x >= 180.0
29
+ @x -= 360.0 if @x > 180.0
60
30
  end
61
31
  @y = 90.0 if @y > 90.0
62
32
  @y = -90.0 if @y < -90.0
@@ -3,36 +3,6 @@
3
3
  # Core calculations on the sphere
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010-2012 Daniel Azuma
7
- #
8
- # All rights reserved.
9
- #
10
- # Redistribution and use in source and binary forms, with or without
11
- # modification, are permitted provided that the following conditions are met:
12
- #
13
- # * Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the following disclaimer.
15
- # * Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the following disclaimer in the documentation
17
- # and/or other materials provided with the distribution.
18
- # * Neither the name of the copyright holder, nor the names of any other
19
- # contributors to this software, may be used to endorse or promote products
20
- # derived from this software without specific prior written permission.
21
- #
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- # POSSIBILITY OF SUCH DAMAGE.
33
- # -----------------------------------------------------------------------------
34
- ;
35
-
36
6
 
37
7
  module RGeo
38
8
 
@@ -3,36 +3,6 @@
3
3
  # GEOS wrapper for RGeo
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010-2012 Daniel Azuma
7
- #
8
- # All rights reserved.
9
- #
10
- # Redistribution and use in source and binary forms, with or without
11
- # modification, are permitted provided that the following conditions are met:
12
- #
13
- # * Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the following disclaimer.
15
- # * Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the following disclaimer in the documentation
17
- # and/or other materials provided with the distribution.
18
- # * Neither the name of the copyright holder, nor the names of any other
19
- # contributors to this software, may be used to endorse or promote products
20
- # derived from this software without specific prior written permission.
21
- #
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- # POSSIBILITY OF SUCH DAMAGE.
33
- # -----------------------------------------------------------------------------
34
- ;
35
-
36
6
 
37
7
  module RGeo
38
8
 
@@ -3,36 +3,6 @@
3
3
  # GEOS factory implementation
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010-2012 Daniel Azuma
7
- #
8
- # All rights reserved.
9
- #
10
- # Redistribution and use in source and binary forms, with or without
11
- # modification, are permitted provided that the following conditions are met:
12
- #
13
- # * Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the following disclaimer.
15
- # * Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the following disclaimer in the documentation
17
- # and/or other materials provided with the distribution.
18
- # * Neither the name of the copyright holder, nor the names of any other
19
- # contributors to this software, may be used to endorse or promote products
20
- # derived from this software without specific prior written permission.
21
- #
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- # POSSIBILITY OF SUCH DAMAGE.
33
- # -----------------------------------------------------------------------------
34
- ;
35
-
36
6
 
37
7
  module RGeo
38
8
 
@@ -182,10 +152,10 @@ module RGeo
182
152
  'hasm' => (_flags & 0x4 != 0),
183
153
  'srid' => _srid,
184
154
  'bufr' => _buffer_resolution,
185
- 'wktg' => _wkt_generator._properties,
186
- 'wkbg' => _wkb_generator._properties,
187
- 'wktp' => _wkt_parser._properties,
188
- 'wkbp' => _wkb_parser._properties,
155
+ 'wktg' => _wkt_generator ? _wkt_generator._properties : {},
156
+ 'wkbg' => _wkb_generator ? _wkb_generator._properties : {},
157
+ 'wktp' => _wkt_parser ? _wkt_parser._properties : {},
158
+ 'wkbp' => _wkb_parser ? _wkb_parser._properties : {},
189
159
  'lmpa' => (_flags & 0x1 != 0),
190
160
  'apre' => ((_flags & 0x8) >> 3),
191
161
  }
@@ -235,10 +205,10 @@ module RGeo
235
205
  coder_['srid'] = _srid
236
206
  coder_['buffer_resolution'] = _buffer_resolution
237
207
  coder_['lenient_multi_polygon_assertions'] = (_flags & 0x1 != 0)
238
- coder_['wkt_generator'] = _wkt_generator._properties
239
- coder_['wkb_generator'] = _wkb_generator._properties
240
- coder_['wkt_parser'] = _wkt_parser._properties
241
- coder_['wkb_parser'] = _wkb_parser._properties
208
+ coder_['wkt_generator'] = _wkt_generator ? _wkt_generator._properties : {}
209
+ coder_['wkb_generator'] = _wkb_generator ? _wkb_generator._properties : {}
210
+ coder_['wkt_parser'] = _wkt_parser ? _wkt_parser._properties : {}
211
+ coder_['wkb_parser'] = _wkb_parser ? _wkb_parser._properties : {}
242
212
  coder_['auto_prepare'] = ((_flags & 0x8) == 0 ? 'disabled' : 'simple')
243
213
  if (proj4_ = self._proj4)
244
214
  str_ = proj4_.original_str || proj4_.canonical_str