Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

ffi-geos is an implementation of the GEOS Ruby bindings in Ruby via FFI.

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Guardfile
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 ffi-geos.gemspec
README.rdoc

GEOS Ruby Bindings via FFI

Requirements

  • the ffi extension for Ruby.

  • GEOS version 3.3.0 or greater. GEOS 3.2.2 and below will work to an extent, but some features and methods will be disabled or missing.

Ruby versions known to work:

  • Ruby MRI 1.8.7, 1.9.2, 1.9.3, 2.0.0 x86_64, OSX 10.6.5+

  • Ruby MRI 1.8.7, 1.9.2, 1.9.3, 2.0.0 i386, linux

  • Ruby MRI 1.8.7, 1.9.2, 1.9.3, 2.0.0 x86_64, linux

  • JRuby 1.6, x86_64 OSX 10.6.5+

JRuby Notes

Note that versions of JRuby prior to version 1.6.3 have problems in their ffi implementation when dealing with AutoPointers that can lead to segfaults during garbage collection.

Features

ffi-geos supports all of the features found in the binary SWIG-based GEOS Ruby bindings along with the following enhancements and additions:

  • support for prepared geometries via Geos::Geometry#to_prepared.

  • an implementation of Geos::STRtree.

  • use of GEOS's re-entrant interface for thread-safety.

  • new options for controlling WKT output like trim and rounding precision.

  • many new methods on geometry types. See below for a list.

  • Geos::LineString, Geos::LinearRing, Geos::CoordinateSequence and Geos::GeometryCollection and its descendants are now enumerable.

  • The aforementioned enumerable classes also define some additional Array-like methods such as [] and slice.

  • Geos::WkbWriter and Geos::WktWriter have had their constructors extended to allow for settings via an options Hash.

  • Geos::WkbWriter#write, Geos::WkbWriter#write_hex and Geos::WktWriter#write have been enhanced to take options Hashes allowing you to set per-write settings.

  • Geos::BufferParams class that allows for more extensive Geos::Geometry#buffer options.

  • Geos::PreparedGeometry class and Geos::Geometry#to_prepared method to allow for prepared geometries and more efficient relationship testing.

  • Geos::Interrupt module that allows you to interrupt certain calls to the GEOS library and perform other work or cancel GEOS calls outright. The interruption API was added in GEOS 3.4.0.

New Methods and Additions (not exhaustive)

  • SRIDs can be copied on many operations. GEOS doesn't usually copy SRIDs around, but for the sake of convenience, we do. The default behaviour for SRID copying can be set via the Geos.srid_copy_policy= method. The default behaviour is to use 0 values as before, but you can optionally allow for copying in either a lenient or a strict sort of manner. See the documentation for Geos.srid_copy_policy= for details.

Geos

  • Many new Geos.create_* methods, such as Geos.create_linear_ring, etc.

  • Geos.srid_copy_policy, srid_copy_policy=, srid_copy_policy_default and srid_copy_policy_default=.

Geos::Geometry

  • Geos::almost_equals?

  • Geos::coord_seq

  • Geos::covered_by?

  • Geos::covers?

  • Geos::delaunay_triangulation

  • Geos::end_point

  • Geos::eql_almost?

  • Geos::equals?

  • Geos::equals_almost?

  • Geos::equals_exact?

  • Geos::exactly_equals?

  • Geos::extract_unique_points - Geos::Geometry#unique_points

  • Geos::hausdorff_distance

  • Geos::interpolate

  • Geos::interpolate_normalized

  • Geos::nearest_points

  • Geos::node

  • Geos::normalize!

  • Geos::num_coordinates

  • Geos::polygonize

  • Geos::polygonize_cut_edges

  • Geos::polygonize_full

  • Geos::project

  • Geos::project_normalized

  • Geos::relate_boundary_node_rule

  • Geos::representative_point

  • Geos::shared_paths

  • Geos::snap

  • Geos::snap_to

  • Geos::start_point

  • Geos::symmetric_difference

  • Geos::to_prepared

  • Geos::unary_union

  • Geos::union_cascaded - Geos::Geometry#union can also be called without a geometry argument to produce the same effect.

  • Geos::unique_points - Geos::Geometry#extract_unique_points

  • Geos::valid_detail

  • Geos::valid_reason

Geos::LineString and Geos::LinearRing

  • Geos::LineString#[]

  • Geos::LineString#closed?

  • Geos::LineString#each

  • Geos::LineString#num_points

  • Geos::LineString#offset_curve

  • Geos::LineString#point_n

  • Geos::LineString#slice

  • Geos::LinearRing#to_line_string

  • Geos::LinearRing#to_polygon

Geos::WktWriter

  • Geos::WktWriter#old_3d

  • Geos::WktWriter#old_3d=

  • Geos::WktWriter#output_dimensions

  • Geos::WktWriter#output_dimensions=

  • Geos::WktWriter#rounding_precision

  • Geos::WktWriter#rounding_precision=

  • Geos::WktWriter#trim

  • Geos::WktWriter#trim=

Geos::CoordinateSequence

  • Geos::CoordinateSequence#has_z?

  • Geos::CoordinateSequence#to_line_string

  • Geos::CoordinateSequence#to_linear_ring

  • Geos::CoordinateSequence#to_point

  • Geos::CoordinateSequence#to_polygon

Geos::Polygon

  • Geos::Polygon#interior_ring

  • Geos::Polygon#interior_rings

Geos::Utils

  • Geos::Utils.orientation_index

  • Geos::Utils.relate_match

Geos::Interrupt

  • Geos::Interrupt.available?

  • Geos::Interrupt.register

  • Geos::Interrupt.request

  • Geos::Interrupt.cancel

  • Geos::Interrupt.clear

Thanks

  • Daniel Azuma for the testing and JRuby help.

  • Christopher Meiklejohn for the bug reporting and PreparedGeometry fix.

  • Wayne Meissner for some help with some ffi issues.

  • Charlie Savage for the original SWIG-based GEOS bindings implementation and some fixes for MinGW.

  • Peter M. Goldstein for some JRuby fixes.

License

This gem is licensed under an MIT-style license. See the MIT-LICENSE file for details.

Something went wrong with that request. Please try again.