sorbet/rbi/gems/rgeo-geojson@2.2.0.rbi
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `rgeo-geojson` gem.
# Please instead update this file by running `bin/tapioca gem rgeo-geojson`.
# source://rgeo-geojson//lib/rgeo/geo_json/version.rb#3
module RGeo; end
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#7
module RGeo::CastOverlay
class << self
# @private
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#8
def included(base); end
end
end
# These convenience methods are added directly into the module rather than
# including the module above into the Feature::Instance module which is in
# every geometry implementation. This is due to a behavior in ruby versions
# <3.0.2 where dynamically included modules will not be included automatically
# in the ancestor tree.
# See https://bugs.ruby-lang.org/issues/9573 for more information.
#
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#26
module RGeo::Feature
include ::RGeo::CastOverlay
class << self
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#12
def cast(obj, *params); end
end
end
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#41
module RGeo::Feature::Factory::Instance
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#45
def parse_geojson(input); end
end
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#27
module RGeo::Feature::Instance
# Convert a geometry to a GeoJSON Hash
#
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#29
def as_geojson; end
# Convert a geometry to a GeoJSON Hash
#
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#29
def as_json; end
# Convert a geometry to a GeoJSON String
#
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#35
def to_geojson; end
# Convert a geometry to a GeoJSON String
#
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#35
def to_json; end
end
# source://rgeo-geojson//lib/rgeo/geo_json/version.rb#4
module RGeo::GeoJSON
class << self
# Creates and returns a coder object of type RGeo::GeoJSON::Coder
# that encapsulates encoding and decoding settings (principally the
# RGeo::Feature::Factory and the RGeo::GeoJSON::EntityFactory to be
# used).
#
# The geo factory is a required argument. Other options include:
#
# [<tt>:geo_factory</tt>]
# Specifies the geo factory to use to create geometry objects.
# Defaults to the preferred cartesian factory.
# [<tt>:entity_factory</tt>]
# Specifies an entity factory, which lets you override the types
# of GeoJSON entities that are created. It defaults to the default
# RGeo::GeoJSON::EntityFactory, which generates objects of type
# RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
# See RGeo::GeoJSON::EntityFactory for more information.
#
# source://rgeo-geojson//lib/rgeo/geo_json/interface.rb#55
def coder(opts = T.unsafe(nil)); end
# High-level convenience routine for decoding an object from GeoJSON.
# The input may be a JSON hash, a String, or an IO object from which
# to read the JSON string.
#
# Options include:
#
# [<tt>:geo_factory</tt>]
# Specifies the geo factory to use to create geometry objects.
# Defaults to the preferred cartesian factory.
# [<tt>:entity_factory</tt>]
# Specifies an entity factory, which lets you override the types
# of GeoJSON entities that are created. It defaults to the default
# RGeo::GeoJSON::EntityFactory, which generates objects of type
# RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
# See RGeo::GeoJSON::EntityFactory for more information.
#
# source://rgeo-geojson//lib/rgeo/geo_json/interface.rb#35
def decode(input, opts = T.unsafe(nil)); end
# High-level convenience routine for encoding an object as GeoJSON.
# Pass the object, which may one of the geometry objects specified
# in RGeo::Feature, or an appropriate GeoJSON wrapper entity such
# as RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
#
# The only option supported is <tt>:entity_factory</tt>, which lets
# you override the types of GeoJSON entities supported. See
# RGeo::GeoJSON::EntityFactory for more information. By default,
# encode supports objects of type RGeo::GeoJSON::Feature and
# RGeo::GeoJSON::FeatureCollection.
#
# source://rgeo-geojson//lib/rgeo/geo_json/interface.rb#16
def encode(object, opts = T.unsafe(nil)); end
end
end
# This object encapsulates encoding and decoding settings (principally
# the RGeo::Feature::Factory and the RGeo::GeoJSON::EntityFactory to
# be used) so that you can encode and decode without specifying those
# settings every time.
#
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#9
class RGeo::GeoJSON::Coder
# Create a new coder settings object. The geo factory is passed as
# a required argument.
#
# Options include:
#
# [<tt>:geo_factory</tt>]
# Specifies the geo factory to use to create geometry objects.
# Defaults to the preferred cartesian factory.
# [<tt>:entity_factory</tt>]
# Specifies an entity factory, which lets you override the types
# of GeoJSON entities that are created. It defaults to the default
# RGeo::GeoJSON::EntityFactory, which generates objects of type
# RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
# See RGeo::GeoJSON::EntityFactory for more information.
#
# @return [Coder] a new instance of Coder
#
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#24
def initialize(opts = T.unsafe(nil)); end
# Decode an object from GeoJSON. The input may be a JSON hash, a
# String, or an IO object from which to read the JSON string.
# If an error occurs, nil is returned.
#
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#61
def decode(input); end
# Encode the given object as GeoJSON. The object may be one of the
# geometry objects specified in RGeo::Feature, or an appropriate
# GeoJSON wrapper entity supported by this coder's entity factory.
#
# This method returns a JSON object (i.e. a hash). In order to
# generate a string suitable for transmitting to a service, you
# will need to JSON-encode it. This is usually accomplished by
# calling <tt>to_json</tt> on the hash object, if you have the
# appropriate JSON library installed.
#
# Returns nil if nil is passed in as the object.
#
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#43
def encode(object); end
# Returns the RGeo::GeoJSON::EntityFactory used to generate GeoJSON
# wrapper entities.
#
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#95
def entity_factory; end
# Returns the RGeo::Feature::Factory used to generate geometry objects.
#
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#90
def geo_factory; end
private
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#152
def decode_feature(input); end
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#161
def decode_geometry(input); end
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#182
def decode_geometry_collection(input); end
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#198
def decode_line_string_coords(line_coords); end
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#238
def decode_multi_line_string_coords(multi_line_coords); end
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#228
def decode_multi_point_coords(multi_point_coords); end
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#248
def decode_multi_polygon_coords(multi_polygon_coords); end
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#193
def decode_point_coords(point_coords); end
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#208
def decode_polygon_coords(poly_coords); end
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#99
def encode_feature(object); end
# source://rgeo-geojson//lib/rgeo/geo_json/coder.rb#110
def encode_geometry(object); end
end
# This module is here to fill the gap between what is a GeometryCollection (GIS)
# and a FeatureCollection (GeoJSON).
#
# Note for contributors, you can rely on `@features` to be defined and
# you can consider working with an Enumerable wrapping `@features`. See
# GeoJSON::FeatureCollection.
#
# source://rgeo-geojson//lib/rgeo/geo_json/collection_methods.rb#10
module RGeo::GeoJSON::CollectionMethods
# @return [Boolean]
#
# source://rgeo-geojson//lib/rgeo/geo_json/collection_methods.rb#27
def contains?(geometry); end
# @return [Boolean]
#
# source://rgeo-geojson//lib/rgeo/geo_json/collection_methods.rb#31
def intersects?(geometry); end
private
# @raise [Error::UnsupportedOperation]
#
# source://rgeo-geojson//lib/rgeo/geo_json/collection_methods.rb#19
def method_missing(symbol, *args); end
class << self
private
# There is tight coupling between {FeatureCollection} and this, hence the
# guard.
#
# @private
# @raise [Error::RGeoError]
#
# source://rgeo-geojson//lib/rgeo/geo_json/collection_methods.rb#13
def included(base); end
end
end
# This module serves to provide handy methods when using GeoJSON. The methods
# provided eases the passage between entities and GeoJSON String/Hash.
#
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#6
module RGeo::GeoJSON::ConversionMethods
# Convert a geometry to a GeoJSON Hash
#
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#8
def as_geojson; end
# Convert a geometry to a GeoJSON Hash
#
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#8
def as_json; end
# Convert a geometry to a GeoJSON String
#
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#14
def to_geojson; end
# Convert a geometry to a GeoJSON String
#
# source://rgeo-geojson//lib/rgeo/geo_json/conversion_methods.rb#14
def to_json; end
end
# Simplify usage of inner geometries for Feature and FeatureCollection
# objets. Including class must contain a `#geometry` method.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#26
module RGeo::GeoJSON::DelegateToGeometry
private
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#27
def method_missing(symbol, *args); end
# @return [Boolean]
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#33
def respond_to_missing?(symbol, *_arg1); end
end
# This is the default entity factory. It creates objects of type
# RGeo::GeoJSON::Feature and RGeo::GeoJSON::FeatureCollection.
# You may create your own entity factory by duck-typing this class.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#186
class RGeo::GeoJSON::EntityFactory
# Create and return a new feature, given geometry, ID, and
# properties hash. Note that, per the GeoJSON spec, geometry and/or
# properties may be nil.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#190
def feature(geometry, id = T.unsafe(nil), properties = T.unsafe(nil)); end
# Create and return a new feature collection, given an enumerable
# of feature objects.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#196
def feature_collection(features = T.unsafe(nil)); end
# Returns the geometry associated with the given feature.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#219
def get_feature_geometry(object); end
# Returns the ID of the given feature, or nil for no ID.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#224
def get_feature_id(object); end
# Returns the properties of the given feature as a hash. Editing
# this hash does not change the state of the feature.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#230
def get_feature_properties(object); end
# Returns true if the given object is a feature created by this
# entity factory.
#
# @return [Boolean]
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#202
def is_feature?(object); end
# Returns true if the given object is a feature collection created
# by this entity factory.
#
# @return [Boolean]
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#208
def is_feature_collection?(object); end
# Run Enumerable#map on the features contained in the given feature
# collection.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#214
def map_feature_collection(object, &block); end
class << self
# Return the singleton instance of EntityFactory.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#235
def instance; end
end
end
# This is a GeoJSON wrapper entity that corresponds to the GeoJSON
# "Feature" type. It is an immutable type.
#
# This is the default implementation that is generated by
# RGeo::GeoJSON::EntityFactory. You may replace this implementation
# by writing your own entity factory. Note that an alternate Feature
# implementation need not subclass or even duck-type this class.
# the entity factory mediates all interaction between the GeoJSON
# engine and features.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#47
class RGeo::GeoJSON::Feature
include ::RGeo::GeoJSON::DelegateToGeometry
include ::RGeo::GeoJSON::ConversionMethods
# Create a feature wrapping the given geometry, with the given ID
# and properties.
#
# @return [Feature] a new instance of Feature
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#53
def initialize(geometry, id = T.unsafe(nil), properties = T.unsafe(nil)); end
# Two features are equal if their geometries, IDs, and properties
# are all equal.
# This method uses the == operator to test geometry equality, which
# may behave differently than the eql? method.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#86
def ==(other); end
# Gets the value of the given named property.
# Returns nil if the given property is not found.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#105
def [](key); end
# Two features are equal if their geometries, IDs, and properties
# are all equal.
# This method uses the eql? method to test geometry equality, which
# may behave differently than the == operator.
#
# @return [Boolean]
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#78
def eql?(other); end
# Returns the ID for this feature, which may be nil.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#94
def feature_id; end
# Returns the geometry contained in this feature, which may be nil.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#91
def geometry; end
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#70
def hash; end
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#62
def inspect; end
# Gets an array of the known property keys in this feature.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#111
def keys; end
# Returns a copy of the properties for this feature.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#99
def properties; end
# Gets the value of the given named property.
# Returns nil if the given property is not found.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#105
def property(key); end
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#66
def to_s; end
end
# This is a GeoJSON wrapper entity that corresponds to the GeoJSON
# "FeatureCollection" type. It is an immutable type.
#
# This is the default implementation that is generated by
# RGeo::GeoJSON::EntityFactory. You may replace this implementation
# by writing your own entity factory. Note that an alternate
# FeatureCollection implementation need not subclass or even
# duck-type this class. The entity factory mediates all interaction
# between the GeoJSON engine and feature collections.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#125
class RGeo::GeoJSON::FeatureCollection
include ::Enumerable
include ::RGeo::GeoJSON::CollectionMethods
include ::RGeo::GeoJSON::ConversionMethods
# Create a new FeatureCollection with the given features, which must
# be provided as an Enumerable.
#
# @return [FeatureCollection] a new instance of FeatureCollection
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#132
def initialize(features = T.unsafe(nil)); end
# Two feature collections are equal if they contain the same
# features in the same order.
# This methods uses the == operator to test geometry equality, which
# may behave differently than the eql? method.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#162
def ==(other); end
# Access a feature by index.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#177
def [](index); end
# Iterates or returns an iterator for the features.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#167
def each(&block); end
# Two feature collections are equal if they contain the same
# features in the same order.
# This methods uses the eql? method to test geometry equality, which
# may behave differently than the == operator.
#
# @return [Boolean]
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#154
def eql?(other); end
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#146
def hash; end
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#138
def inspect; end
# Returns the number of features contained in this collection.
#
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#172
def size; end
# source://rgeo-geojson//lib/rgeo/geo_json/entities.rb#142
def to_s; end
end
# source://rgeo-geojson//lib/rgeo/geo_json/version.rb#5
RGeo::GeoJSON::VERSION = T.let(T.unsafe(nil), String)