Module: RGeo

Defined in:
lib/rgeo.rb,
lib/rgeo/geos.rb,
lib/rgeo/error.rb,
lib/rgeo/wkrep.rb,
lib/rgeo/feature.rb,
lib/rgeo/version.rb,
lib/rgeo/cartesian.rb,
lib/rgeo/coord_sys.rb,
lib/rgeo/geographic.rb,
lib/rgeo/impl_helper.rb,
lib/rgeo/feature/line.rb,
lib/rgeo/geos/factory.rb,
lib/rgeo/geos/zm_impl.rb,
lib/rgeo/feature/curve.rb,
lib/rgeo/feature/point.rb,
lib/rgeo/feature/types.rb,
lib/rgeo/geos/interface.rb,
lib/rgeo/coord_sys/proj4.rb,
lib/rgeo/feature/factory.rb,
lib/rgeo/feature/polygon.rb,
lib/rgeo/feature/surface.rb,
lib/rgeo/geos/zm_factory.rb,
lib/rgeo/feature/geometry.rb,
lib/rgeo/impl_helper/math.rb,
lib/rgeo/wkrep/wkb_parser.rb,
lib/rgeo/wkrep/wkt_parser.rb,
lib/rgeo/cartesian/factory.rb,
lib/rgeo/cartesian/analysis.rb,
lib/rgeo/geographic/factory.rb,
lib/rgeo/cartesian/interface.rb,
lib/rgeo/feature/line_string.rb,
lib/rgeo/feature/linear_ring.rb,
lib/rgeo/feature/multi_curve.rb,
lib/rgeo/feature/multi_point.rb,
lib/rgeo/geos/impl_additions.rb,
lib/rgeo/wkrep/wkb_generator.rb,
lib/rgeo/wkrep/wkt_generator.rb,
lib/rgeo/geographic/interface.rb,
lib/rgeo/coord_sys/cs/entities.rb,
lib/rgeo/feature/multi_polygon.rb,
lib/rgeo/feature/multi_surface.rb,
lib/rgeo/cartesian/bounding_box.rb,
lib/rgeo/cartesian/calculations.rb,
lib/rgeo/coord_sys/cs/factories.rb,
lib/rgeo/coord_sys/cs/wkt_parser.rb,
lib/rgeo/cartesian/feature_classes.rb,
lib/rgeo/cartesian/feature_methods.rb,
lib/rgeo/feature/factory_generator.rb,
lib/rgeo/feature/multi_line_string.rb,
lib/rgeo/geographic/spherical_math.rb,
lib/rgeo/geographic/proj4_projector.rb,
lib/rgeo/feature/geometry_collection.rb,
lib/rgeo/geographic/projected_window.rb,
lib/rgeo/coord_sys/srs_database/sr_org.rb,
lib/rgeo/impl_helper/basic_point_methods.rb,
lib/rgeo/coord_sys/srs_database/interface.rb,
lib/rgeo/coord_sys/srs_database/proj4_data.rb,
lib/rgeo/coord_sys/srs_database/url_reader.rb,
lib/rgeo/impl_helper/basic_polygon_methods.rb,
lib/rgeo/impl_helper/basic_geometry_methods.rb,
lib/rgeo/geographic/projected_feature_classes.rb,
lib/rgeo/geographic/projected_feature_methods.rb,
lib/rgeo/geographic/simple_mercator_projector.rb,
lib/rgeo/geographic/spherical_feature_classes.rb,
lib/rgeo/geographic/spherical_feature_methods.rb,
lib/rgeo/impl_helper/basic_line_string_methods.rb,
lib/rgeo/coord_sys/srs_database/active_record_table.rb,
lib/rgeo/impl_helper/basic_geometry_collection_methods.rb,
ext/proj4_c_impl/main.c

Overview

RGeo is a spatial data library for Ruby. It focuses on the storage and manipulation of spatial data types such as points, lines, and polygons.

RGeo comprises a number of modules. The “rgeo” gem provides a suite of standard modules. Additional optional modules are provided by separate gems with names of the form “rgeo-*”.

Standard modules

These are the standard modules provided by the “rgeo” gem.

  • RGeo::Feature contains interface specifications for spatial objects implemented by RGeo. These interfaces closely follow the OGC Simple Features Specifiation (SFS). This module forms the core of RGeo.

  • RGeo::CoordSys contains classes for representing spatial reference systems and coordinate transformations. For example, it includes a wrapper for the Proj4 library, supporting many geographic projections.

  • RGeo::Cartesian is a gateway for geometric data implementations that operate in Caresian (flat) coordinate systems. It also provides a basic pure ruby Cartesian implementation. This implementation does not cover all the geometric analysis operations defined by the SFS, but it does not require an external C library and is often sufficient for basic applications.

  • RGeo::Geos is another Cartesian implementation that wraps the GEOS library to provide a full, high-performance implementation of Cartesian geometry that includes every operation defined in the SFS. It requires GEOS 3.2 or later.

  • RGeo::Geographic contains spatial implementations that operate in latitude-longitude coordinates and are well-suited for geographic location based applications. Geographic spatial objects may also be linked to projections.

  • RGeo::WKRep contains tools for reading and writing spatial data in the OGC Well-Known Text (WKT) and Well-Known Binary (WKB) representations. It also supports common variants such as the PostGIS EWKT and EWKB representations.

Optional Modules

Here is a partial list of optional modules available as separate gems.

  • rgeo-geojson provides the RGeo::GeoJSON module, containing tools for GeoJSON encoding and decoding of spatial objects.

  • rgeo-shapefile provides the RGeo::Shapefile module, containing tools for reading ESRI shapefiles.

  • rgeo-activerecord provides the RGeo::ActiveRecord module, containing some ActiveRecord extensions for spatial databases, and a set of common tools for ActiveRecord spatial database adapters.

Several ActiveRecord adapters use RGeo. These include:

  • mysqlspatial, an adapter for MySQL spatial extensions based on the mysql adapter. Available as the activerecord-mysqlspatial-adapter gem.

  • mysql2spatial, an adapter for MySQL spatial extensions based on the mysql2 adapter. Available as the activerecord-mysql2spatial-adapter gem.

  • spatialite, an adapter for the SpatiaLite extension to the Sqlite3 database, and based on the sqlite3 adapter. Available as the activerecord-spatialite-adapter gem.

  • postgis, an adapter for the PostGIS extension to the PostgreSQL database, and based on the postgresql adapter. Available as the activerecord-postgis-adapter gem.

Defined Under Namespace

Modules: Cartesian, CoordSys, Error, Feature, Geographic, Geos, ImplHelper, WKRep

Constant Summary collapse

VERSION_STRING =

Current version of RGeo as a frozen string

::File.read(::File.dirname(__FILE__)+'/../../Version').strip.freeze
VERSION =

Current version of RGeo as a Versionomy object, if the Versionomy gem is available.

defined?(::Versionomy) ? ::Versionomy.parse(VERSION_STRING) : VERSION_STRING