rgeo 0.1.22 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +31 -0
- data/README.rdoc +53 -59
- data/Spatial_Programming_With_RGeo.rdoc +120 -67
- data/Version +1 -1
- data/ext/proj4_c_impl/extconf.rb +1 -1
- data/lib/rgeo.rb +80 -87
- data/lib/rgeo/cartesian.rb +0 -10
- data/lib/rgeo/coord_sys.rb +0 -7
- data/lib/rgeo/coord_sys/proj4.rb +2 -2
- data/lib/rgeo/error.rb +2 -6
- data/lib/rgeo/feature.rb +0 -7
- data/lib/rgeo/feature/curve.rb +5 -5
- data/lib/rgeo/feature/factory.rb +45 -5
- data/lib/rgeo/feature/factory_generator.rb +2 -4
- data/lib/rgeo/feature/geometry.rb +97 -27
- data/lib/rgeo/feature/geometry_collection.rb +3 -3
- data/lib/rgeo/feature/line_string.rb +3 -3
- data/lib/rgeo/feature/multi_curve.rb +2 -2
- data/lib/rgeo/feature/multi_surface.rb +3 -3
- data/lib/rgeo/feature/point.rb +6 -6
- data/lib/rgeo/feature/polygon.rb +4 -4
- data/lib/rgeo/feature/surface.rb +3 -3
- data/lib/rgeo/geographic.rb +0 -11
- data/lib/rgeo/geographic/factory.rb +5 -2
- data/lib/rgeo/geographic/interface.rb +1 -1
- data/lib/rgeo/geos.rb +0 -7
- data/lib/rgeo/geos/factory.rb +1 -1
- data/lib/rgeo/impl_helper.rb +0 -7
- data/lib/rgeo/wkrep.rb +0 -7
- data/lib/rgeo/wkrep/wkb_parser.rb +2 -2
- data/test/tc_oneoff.rb +0 -1
- metadata +7 -155
- data/lib/active_record/connection_adapters/mysql2spatial_adapter.rb +0 -124
- data/lib/active_record/connection_adapters/mysqlspatial_adapter.rb +0 -136
- data/lib/active_record/connection_adapters/postgis_adapter.rb +0 -426
- data/lib/active_record/connection_adapters/spatialite_adapter.rb +0 -488
- data/lib/rgeo/active_record/arel_modifications.rb +0 -78
- data/lib/rgeo/active_record/base_modifications.rb +0 -124
- data/lib/rgeo/active_record/common.rb +0 -166
- data/lib/rgeo/active_record/mysql_common.rb +0 -150
- data/lib/rgeo/all.rb +0 -49
- data/lib/rgeo/geo_json.rb +0 -60
- data/lib/rgeo/geo_json/coder.rb +0 -401
- data/lib/rgeo/geo_json/entities.rb +0 -285
- data/lib/rgeo/geo_json/interface.rb +0 -129
- data/lib/rgeo/shapefile.rb +0 -60
- data/lib/rgeo/shapefile/reader.rb +0 -898
- data/test/active_record/common_setup_methods.rb +0 -129
- data/test/active_record/readme.txt +0 -43
- data/test/active_record/tc_mysqlspatial.rb +0 -170
- data/test/active_record/tc_postgis.rb +0 -282
- data/test/active_record/tc_spatialite.rb +0 -198
- data/test/shapefile/shapelib_testcases/readme.txt +0 -11
- data/test/shapefile/shapelib_testcases/test.dbf +0 -0
- data/test/shapefile/shapelib_testcases/test.shp +0 -0
- data/test/shapefile/shapelib_testcases/test.shx +0 -0
- data/test/shapefile/shapelib_testcases/test0.shp +0 -0
- data/test/shapefile/shapelib_testcases/test0.shx +0 -0
- data/test/shapefile/shapelib_testcases/test1.shp +0 -0
- data/test/shapefile/shapelib_testcases/test1.shx +0 -0
- data/test/shapefile/shapelib_testcases/test10.shp +0 -0
- data/test/shapefile/shapelib_testcases/test10.shx +0 -0
- data/test/shapefile/shapelib_testcases/test11.shp +0 -0
- data/test/shapefile/shapelib_testcases/test11.shx +0 -0
- data/test/shapefile/shapelib_testcases/test12.shp +0 -0
- data/test/shapefile/shapelib_testcases/test12.shx +0 -0
- data/test/shapefile/shapelib_testcases/test13.shp +0 -0
- data/test/shapefile/shapelib_testcases/test13.shx +0 -0
- data/test/shapefile/shapelib_testcases/test2.shp +0 -0
- data/test/shapefile/shapelib_testcases/test2.shx +0 -0
- data/test/shapefile/shapelib_testcases/test3.shp +0 -0
- data/test/shapefile/shapelib_testcases/test3.shx +0 -0
- data/test/shapefile/shapelib_testcases/test4.shp +0 -0
- data/test/shapefile/shapelib_testcases/test4.shx +0 -0
- data/test/shapefile/shapelib_testcases/test5.shp +0 -0
- data/test/shapefile/shapelib_testcases/test5.shx +0 -0
- data/test/shapefile/shapelib_testcases/test6.shp +0 -0
- data/test/shapefile/shapelib_testcases/test6.shx +0 -0
- data/test/shapefile/shapelib_testcases/test7.shp +0 -0
- data/test/shapefile/shapelib_testcases/test7.shx +0 -0
- data/test/shapefile/shapelib_testcases/test8.shp +0 -0
- data/test/shapefile/shapelib_testcases/test8.shx +0 -0
- data/test/shapefile/shapelib_testcases/test9.shp +0 -0
- data/test/shapefile/shapelib_testcases/test9.shx +0 -0
- data/test/shapefile/tc_shapelib_tests.rb +0 -527
- data/test/tc_geojson.rb +0 -279
@@ -1,285 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# GeoJSON standard entities
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 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
|
-
|
37
|
-
module RGeo
|
38
|
-
|
39
|
-
module GeoJSON
|
40
|
-
|
41
|
-
|
42
|
-
# This is a GeoJSON wrapper entity that corresponds to the GeoJSON
|
43
|
-
# "Feature" type. It is an immutable type.
|
44
|
-
#
|
45
|
-
# This is the default implementation that is generated by
|
46
|
-
# RGeo::GeoJSON::EntityFactory. You may replace this implementation
|
47
|
-
# by writing your own entity factory. Note that an alternate Feature
|
48
|
-
# implementation need not subclass or even duck-type this class.
|
49
|
-
# the entity factory mediates all interaction between the GeoJSON
|
50
|
-
# engine and features.
|
51
|
-
|
52
|
-
class Feature
|
53
|
-
|
54
|
-
|
55
|
-
# Create a feature wrapping the given geometry, with the given ID
|
56
|
-
# and properties.
|
57
|
-
|
58
|
-
def initialize(geometry_, id_=nil, properties_={})
|
59
|
-
@geometry = geometry_
|
60
|
-
@id = id_
|
61
|
-
@properties = properties_.dup
|
62
|
-
end
|
63
|
-
|
64
|
-
|
65
|
-
def inspect # :nodoc:
|
66
|
-
"#<#{self.class}:0x#{object_id.to_s(16)} id=#{@id.inspect} geom=#{@geometry ? @geometry.as_text.inspect : 'nil'}>"
|
67
|
-
end
|
68
|
-
|
69
|
-
def to_s # :nodoc:
|
70
|
-
inspect
|
71
|
-
end
|
72
|
-
|
73
|
-
def hash # :nodoc:
|
74
|
-
@geometry.hash + @id.hash + @properties.hash
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
# Two features are equal if their geometries, IDs, and properties
|
79
|
-
# are all equal.
|
80
|
-
# This method uses the eql? method to test geometry equality, which
|
81
|
-
# may behave differently than the == operator.
|
82
|
-
|
83
|
-
def eql?(rhs_)
|
84
|
-
rhs_.kind_of?(Feature) && @geometry.eql?(rhs_.geometry) && @id.eql?(rhs_.feature_id) && @properties.eql?(rhs_.properties)
|
85
|
-
end
|
86
|
-
|
87
|
-
|
88
|
-
# Two features are equal if their geometries, IDs, and properties
|
89
|
-
# are all equal.
|
90
|
-
# This method uses the == operator to test geometry equality, which
|
91
|
-
# may behave differently than the eql? method.
|
92
|
-
|
93
|
-
def ==(rhs_)
|
94
|
-
rhs_.kind_of?(Feature) && @geometry == rhs_.geometry && @id.eql?(rhs_.feature_id) && @properties.eql?(rhs_.properties)
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
# Returns the geometry contained in this feature, which may be nil.
|
99
|
-
|
100
|
-
def geometry
|
101
|
-
@geometry
|
102
|
-
end
|
103
|
-
|
104
|
-
|
105
|
-
# Returns the ID for this feature, which may be nil.
|
106
|
-
|
107
|
-
def feature_id
|
108
|
-
@id
|
109
|
-
end
|
110
|
-
|
111
|
-
|
112
|
-
# Returns a copy of the properties for this feature.
|
113
|
-
|
114
|
-
def properties
|
115
|
-
@properties.dup
|
116
|
-
end
|
117
|
-
|
118
|
-
|
119
|
-
end
|
120
|
-
|
121
|
-
|
122
|
-
# This is a GeoJSON wrapper entity that corresponds to the GeoJSON
|
123
|
-
# "FeatureCollection" type. It is an immutable type.
|
124
|
-
#
|
125
|
-
# This is the default implementation that is generated by
|
126
|
-
# RGeo::GeoJSON::EntityFactory. You may replace this implementation
|
127
|
-
# by writing your own entity factory. Note that an alternate
|
128
|
-
# FeatureCollection implementation need not subclass or even
|
129
|
-
# duck-type this class. The entity factory mediates all interaction
|
130
|
-
# between the GeoJSON engine and feature collections.
|
131
|
-
|
132
|
-
class FeatureCollection
|
133
|
-
|
134
|
-
include ::Enumerable
|
135
|
-
|
136
|
-
|
137
|
-
# Create a new FeatureCollection with the given features, which must
|
138
|
-
# be provided as an Enumerable.
|
139
|
-
|
140
|
-
def initialize(features_=[])
|
141
|
-
@features = []
|
142
|
-
features_.each{ |f_| @features << f_ if f_.kind_of?(Feature) }
|
143
|
-
end
|
144
|
-
|
145
|
-
|
146
|
-
def inspect # :nodoc:
|
147
|
-
"#<#{self.class}:0x#{object_id.to_s(16)}>"
|
148
|
-
end
|
149
|
-
|
150
|
-
def to_s # :nodoc:
|
151
|
-
inspect
|
152
|
-
end
|
153
|
-
|
154
|
-
def hash # :nodoc:
|
155
|
-
@features.hash
|
156
|
-
end
|
157
|
-
|
158
|
-
|
159
|
-
# Two feature collections are equal if they contain the same
|
160
|
-
# features in the same order.
|
161
|
-
# This methods uses the eql? method to test geometry equality, which
|
162
|
-
# may behave differently than the == operator.
|
163
|
-
|
164
|
-
def eql?(rhs_)
|
165
|
-
rhs_.kind_of?(FeatureCollection) && @features.eql?(rhs_.instance_variable_get(:@features))
|
166
|
-
end
|
167
|
-
|
168
|
-
|
169
|
-
# Two feature collections are equal if they contain the same
|
170
|
-
# features in the same order.
|
171
|
-
# This methods uses the == operator to test geometry equality, which
|
172
|
-
# may behave differently than the eql? method.
|
173
|
-
|
174
|
-
def ==(rhs_)
|
175
|
-
rhs_.kind_of?(FeatureCollection) && @features == rhs_.instance_variable_get(:@features)
|
176
|
-
end
|
177
|
-
|
178
|
-
|
179
|
-
# Iterates or returns an iterator for the features.
|
180
|
-
|
181
|
-
def each(&block_)
|
182
|
-
@features.each(&block_)
|
183
|
-
end
|
184
|
-
|
185
|
-
|
186
|
-
# Returns the number of features contained in this collection.
|
187
|
-
|
188
|
-
def size
|
189
|
-
@features.size
|
190
|
-
end
|
191
|
-
|
192
|
-
|
193
|
-
# Access a feature by index.
|
194
|
-
|
195
|
-
def [](index_)
|
196
|
-
@features[index_]
|
197
|
-
end
|
198
|
-
|
199
|
-
|
200
|
-
end
|
201
|
-
|
202
|
-
|
203
|
-
# This is the default entity factory. It creates objects of type
|
204
|
-
# RGeo::GeoJSON::Feature and RGeo::GeoJSON::FeatureCollection.
|
205
|
-
# You may create your own entity factory by duck-typing this class.
|
206
|
-
|
207
|
-
class EntityFactory
|
208
|
-
|
209
|
-
|
210
|
-
# Create and return a new feature, given geometry, ID, and
|
211
|
-
# properties hash. Note that, per the GeoJSON spec, geometry and/or
|
212
|
-
# properties may be nil.
|
213
|
-
|
214
|
-
def feature(geometry_, id_=nil, properties_=nil)
|
215
|
-
Feature.new(geometry_, id_, properties_ || {})
|
216
|
-
end
|
217
|
-
|
218
|
-
|
219
|
-
# Create and return a new feature collection, given an enumerable
|
220
|
-
# of feature objects.
|
221
|
-
|
222
|
-
def feature_collection(features_=[])
|
223
|
-
FeatureCollection.new(features_)
|
224
|
-
end
|
225
|
-
|
226
|
-
|
227
|
-
# Returns true if the given object is a feature created by this
|
228
|
-
# entity factory.
|
229
|
-
|
230
|
-
def is_feature?(object_)
|
231
|
-
object_.kind_of?(Feature)
|
232
|
-
end
|
233
|
-
|
234
|
-
|
235
|
-
# Returns true if the given object is a feature collection created
|
236
|
-
# by this entity factory.
|
237
|
-
|
238
|
-
def is_feature_collection?(object_)
|
239
|
-
object_.kind_of?(FeatureCollection)
|
240
|
-
end
|
241
|
-
|
242
|
-
|
243
|
-
# Run Enumerable#map on the features contained in the given feature
|
244
|
-
# collection.
|
245
|
-
|
246
|
-
def map_feature_collection(object_, &block_)
|
247
|
-
object_.map(&block_)
|
248
|
-
end
|
249
|
-
|
250
|
-
|
251
|
-
# Returns the geometry associated with the given feature.
|
252
|
-
|
253
|
-
def get_feature_geometry(object_)
|
254
|
-
object_.geometry
|
255
|
-
end
|
256
|
-
|
257
|
-
|
258
|
-
# Returns the ID of the given feature, or nil for no ID.
|
259
|
-
|
260
|
-
def get_feature_id(object_)
|
261
|
-
object_.feature_id
|
262
|
-
end
|
263
|
-
|
264
|
-
|
265
|
-
# Returns the properties of the given feature as a hash. Editing
|
266
|
-
# this hash does not change the state of the feature.
|
267
|
-
|
268
|
-
def get_feature_properties(object_)
|
269
|
-
object_.properties
|
270
|
-
end
|
271
|
-
|
272
|
-
|
273
|
-
# Return the singleton instance of EntityFactory.
|
274
|
-
|
275
|
-
def self.instance
|
276
|
-
@instance ||= self.new
|
277
|
-
end
|
278
|
-
|
279
|
-
|
280
|
-
end
|
281
|
-
|
282
|
-
|
283
|
-
end
|
284
|
-
|
285
|
-
end
|
@@ -1,129 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# GeoJSON toplevel interface
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 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
|
-
|
37
|
-
module RGeo
|
38
|
-
|
39
|
-
module GeoJSON
|
40
|
-
|
41
|
-
class << self
|
42
|
-
|
43
|
-
|
44
|
-
# High-level convenience routine for encoding an object as GeoJSON.
|
45
|
-
# Pass the object, which may one of the geometry objects specified
|
46
|
-
# in RGeo::Feature, or an appropriate GeoJSON wrapper entity such
|
47
|
-
# as RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
|
48
|
-
#
|
49
|
-
# The only option supported is <tt>:entity_factory</tt>, which lets
|
50
|
-
# you override the types of GeoJSON entities supported. See
|
51
|
-
# RGeo::GeoJSON::EntityFactory for more information. By default,
|
52
|
-
# encode supports objects of type RGeo::GeoJSON::Feature and
|
53
|
-
# RGeo::GeoJSON::FeatureCollection.
|
54
|
-
|
55
|
-
def encode(object_, opts_={})
|
56
|
-
Coder.new(opts_).encode(object_)
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
# High-level convenience routine for decoding an object from GeoJSON.
|
61
|
-
# The input may be a JSON hash, a String, or an IO object from which
|
62
|
-
# to read the JSON string.
|
63
|
-
#
|
64
|
-
# Options include:
|
65
|
-
#
|
66
|
-
# <tt>:geo_factory</tt>::
|
67
|
-
# Specifies the geo factory to use to create geometry objects.
|
68
|
-
# Defaults to the preferred cartesian factory.
|
69
|
-
# <tt>:entity_factory</tt>::
|
70
|
-
# Specifies an entity factory, which lets you override the types
|
71
|
-
# of GeoJSON entities that are created. It defaults to the default
|
72
|
-
# RGeo::GeoJSON::EntityFactory, which generates objects of type
|
73
|
-
# RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
|
74
|
-
# See RGeo::GeoJSON::EntityFactory for more information.
|
75
|
-
# <tt>:json_parser</tt>::
|
76
|
-
# Specifies a JSON parser to use when decoding a String or IO
|
77
|
-
# object. The value may be a Proc object taking the string as the
|
78
|
-
# sole argument and returning the JSON hash, or it may be one of
|
79
|
-
# the special values <tt>:json</tt>, <tt>:yajl</tt>, or
|
80
|
-
# <tt>:active_support</tt>. Setting one of those special values
|
81
|
-
# will require the corresponding library to be available. Note
|
82
|
-
# that the <tt>:json</tt> library is present in the standard
|
83
|
-
# library in Ruby 1.9, but requires the "json" gem in Ruby 1.8.
|
84
|
-
# If a parser is not specified, then the decode method will not
|
85
|
-
# accept a String or IO object; it will require a Hash.
|
86
|
-
|
87
|
-
def decode(input_, opts_={})
|
88
|
-
Coder.new(opts_).decode(input_)
|
89
|
-
end
|
90
|
-
|
91
|
-
|
92
|
-
# Creates and returns a coder object of type RGeo::GeoJSON::Coder
|
93
|
-
# that encapsulates encoding and decoding settings (principally the
|
94
|
-
# RGeo::Feature::Factory and the RGeo::GeoJSON::EntityFactory to be
|
95
|
-
# used).
|
96
|
-
#
|
97
|
-
# The geo factory is a required argument. Other options include:
|
98
|
-
#
|
99
|
-
# <tt>:geo_factory</tt>::
|
100
|
-
# Specifies the geo factory to use to create geometry objects.
|
101
|
-
# Defaults to the preferred cartesian factory.
|
102
|
-
# <tt>:entity_factory</tt>::
|
103
|
-
# Specifies an entity factory, which lets you override the types
|
104
|
-
# of GeoJSON entities that are created. It defaults to the default
|
105
|
-
# RGeo::GeoJSON::EntityFactory, which generates objects of type
|
106
|
-
# RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
|
107
|
-
# See RGeo::GeoJSON::EntityFactory for more information.
|
108
|
-
# <tt>:json_parser</tt>::
|
109
|
-
# Specifies a JSON parser to use when decoding a String or IO
|
110
|
-
# object. The value may be a Proc object taking the string as the
|
111
|
-
# sole argument and returning the JSON hash, or it may be one of
|
112
|
-
# the special values <tt>:json</tt>, <tt>:yajl</tt>, or
|
113
|
-
# <tt>:active_support</tt>. Setting one of those special values
|
114
|
-
# will require the corresponding library to be available. Note
|
115
|
-
# that the <tt>:json</tt> library is present in the standard
|
116
|
-
# library in Ruby 1.9, but requires the "json" gem in Ruby 1.8.
|
117
|
-
# If a parser is not specified, then the decode method will not
|
118
|
-
# accept a String or IO object; it will require a Hash.
|
119
|
-
|
120
|
-
def coder(opts_={})
|
121
|
-
Coder.new(opts_)
|
122
|
-
end
|
123
|
-
|
124
|
-
|
125
|
-
end
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
end
|
data/lib/rgeo/shapefile.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Shapefile processing for RGeo
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 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
|
-
|
37
|
-
# Parent file
|
38
|
-
require 'rgeo'
|
39
|
-
|
40
|
-
|
41
|
-
module RGeo
|
42
|
-
|
43
|
-
|
44
|
-
# This module contains an implementation of ESRI Shapefiles.
|
45
|
-
# Use the Shapefile::Reader class to read a shapefile, extracting
|
46
|
-
# geometry and attribute data from it.
|
47
|
-
# RGeo does not yet have support for writing shapefiles.
|
48
|
-
|
49
|
-
module Shapefile
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
# Dependency files
|
57
|
-
require 'rgeo/feature'
|
58
|
-
|
59
|
-
# Implementation files
|
60
|
-
require 'rgeo/shapefile/reader'
|