Module: Geos
- Includes:
- GeomTypes, VersionConstants
- Defined in:
- lib/ffi-geos.rb,
lib/ffi-geos/point.rb,
lib/ffi-geos/tools.rb,
lib/ffi-geos/utils.rb,
lib/ffi-geos/polygon.rb,
lib/ffi-geos/strtree.rb,
lib/ffi-geos/version.rb,
lib/ffi-geos/geometry.rb,
lib/ffi-geos/interrupt.rb,
lib/ffi-geos/wkb_reader.rb,
lib/ffi-geos/wkb_writer.rb,
lib/ffi-geos/wkt_reader.rb,
lib/ffi-geos/wkt_writer.rb,
lib/ffi-geos/line_string.rb,
lib/ffi-geos/linear_ring.rb,
lib/ffi-geos/multi_point.rb,
lib/ffi-geos/buffer_params.rb,
lib/ffi-geos/multi_polygon.rb,
lib/ffi-geos/geojson_reader.rb,
lib/ffi-geos/geojson_writer.rb,
lib/ffi-geos/multi_line_string.rb,
lib/ffi-geos/prepared_geometry.rb,
lib/ffi-geos/coordinate_sequence.rb,
lib/ffi-geos/geometry_collection.rb
Defined Under Namespace
Modules: Constants, FFIGeos, GeomTypes, Interrupt, Tools, Utils, VersionConstants
Classes: BufferParams, CoordinateSequence, Error, GEOSException, GeoJSONReader, GeoJSONWriter, Geometry, GeometryCollection, Handle, IndexBoundsError, InvalidGeometryError, InvalidGeometryTypeError, LineString, LinearRing, MixedSRIDsError, MultiLineString, MultiPoint, MultiPolygon, NullPointerError, ParseError, Point, Polygon, PreparedGeometry, STRtree, UnexpectedBooleanResultError, WkbReader, WkbWriter, WktReader, WktWriter
Constant Summary
collapse
- GEOS_BASE =
File.join(File.dirname(__FILE__), 'ffi-geos')
- DimensionTypes =
enum(:dimension_type, [
:dontcare, -3,
:non_empty, -2,
:empty, -1,
:point, 0,
:curve, 1,
:surface, 2
])
- ByteOrders =
enum(:byte_order, [
:xdr, 0, :ndr, 1 ])
- Flavors =
enum(:flavor, [
:extended, 1,
:iso, 2
])
- BufferCapStyles =
enum(:buffer_cap_style, [
:round, 1,
:flat, 2,
:square, 3
])
- BufferJoinStyles =
enum(:buffer_join_style, [
:round, 1,
:mitre, 2,
:bevel, 3
])
- ValidFlags =
enum(:valid_flag, [
:allow_selftouching_ring_forming_hole, 1
])
- RelateBoundaryNodeRules =
enum(:relate_boundary_node_rule, [
:mod2, 1,
:ogc, 1,
:endpoint, 2,
:multivalent_endpoint, 3,
:monovalent_endpoint, 4
])
- GeometryTypes =
enum(:geometry_type, [
:point, 0,
:line_string, 1,
:linear_ring, 2,
:polygon, 3,
:multi_point, 4,
:multi_line_string, 5,
:multi_polygon, 6,
:geometry_collection, 7
])
- PrecisionOptions =
enum(:precision_option, [
:no_topology, 1 << 0,
:keep_collapsed, 1 << 1
])
- VERSION =
'2.4.0'
VersionConstants::GEOS_CAPI_FIRST_INTERFACE, VersionConstants::GEOS_CAPI_LAST_INTERFACE, VersionConstants::GEOS_JTS_PORT, VersionConstants::GEOS_NICE_VERSION
Constants included
from GeomTypes
GeomTypes::GEOS_GEOMETRYCOLLECTION, GeomTypes::GEOS_LINEARRING, GeomTypes::GEOS_LINESTRING, GeomTypes::GEOS_MULTILINESTRING, GeomTypes::GEOS_MULTIPOINT, GeomTypes::GEOS_MULTIPOLYGON, GeomTypes::GEOS_POINT, GeomTypes::GEOS_POLYGON
Class Method Summary
collapse
Class Method Details
.current_handle ⇒ Object
1346
1347
1348
|
# File 'lib/ffi-geos.rb', line 1346
def current_handle
Thread.current[:ffi_geos_handle] ||= Geos::Handle.new
end
|
.current_handle_pointer ⇒ Object
1350
1351
1352
|
# File 'lib/ffi-geos.rb', line 1350
def current_handle_pointer
current_handle.ptr
end
|
.jts_port ⇒ Object
1342
1343
1344
|
# File 'lib/ffi-geos.rb', line 1342
def jts_port
@jts_port ||= FFIGeos.GEOSjtsport
end
|
.srid_copy_policy ⇒ Object
1354
1355
1356
|
# File 'lib/ffi-geos.rb', line 1354
def srid_copy_policy
Thread.current[:ffi_geos_srid_copy_policy] ||= srid_copy_policy_default
end
|
.srid_copy_policy=(policy) ⇒ Object
Sets the SRID copying behaviour. This value can be one of the values found in Geos::Constants::SRID_COPY_POLICIES and are local to the current thread. A special value of :default
can also be used, which will use a global default that can be set with srid_copy_policy_default=. Setting this value will cause all future threads to use this global default rather than the true default value which is set to :zero
for the sake of backwards compatibility with
The available values for policy
are:
-
:default
- use the value set with srid_copy_policy_default=, which itself is :zero
.
-
:zero
- set all SRIDs to 0. The only exception to this is when cloning a Geometry, in which the SRID is always copied as per the previous behaviour.
-
:lenient
- when copying SRIDs, use the SRID of the object that the operation is being performed on, even if operation involves multiple Geometry objects that may have different SRIDs.
-
:strict
- when copying SRIDs, raise a Geos::MixedSRIDsError exception if an operation is performed on mixed SRIDs. This setting
1378
1379
1380
1381
1382
1383
1384
1385
1386
|
# File 'lib/ffi-geos.rb', line 1378
def srid_copy_policy=(policy)
if policy == :default
Thread.current[:ffi_geos_srid_copy_policy] = srid_copy_policy_default
elsif Geos::Constants::SRID_COPY_POLICIES.include?(policy)
Thread.current[:ffi_geos_srid_copy_policy] = policy
else
raise ArgumentError, "Invalid SRID policy #{policy} (must be one of #{Geos::Constants::SRID_COPY_POLICIES})"
end
end
|
.srid_copy_policy_default ⇒ Object
1388
1389
1390
|
# File 'lib/ffi-geos.rb', line 1388
def srid_copy_policy_default
@srid_copy_policy_default ||= :zero
end
|
.srid_copy_policy_default=(policy) ⇒ Object
1392
1393
1394
1395
1396
1397
1398
1399
1400
|
# File 'lib/ffi-geos.rb', line 1392
def srid_copy_policy_default=(policy)
if policy == :default
@srid_copy_policy_default = :zero
elsif Geos::Constants::SRID_COPY_POLICIES.include?(policy)
@srid_copy_policy_default = policy
else
raise ArgumentError, "Invalid SRID policy #{policy} (must be one of #{Geos::Constants::SRID_COPY_POLICIES})"
end
end
|
.version ⇒ Object
1338
1339
1340
|
# File 'lib/ffi-geos.rb', line 1338
def version
@version ||= FFIGeos.GEOSversion.strip
end
|