GeoSQL.MM (GeoSQL v1.3.0)
View SourceFunctions from the SQL/MM standard that can used in Ecto queries.
Examples
defmodule Example do
import Ecto.Query
use GeoSQL.MM
def example_query(geom) do
from location in Location, limit: 5, select: MM.distance(location.geom, ^geom)
end
end
Summary
Geometry Accessors
Note: this function takes an optional Ecto.Repo parameter due to some backends implementing the non-standard ST_NDims rather than ST_CoordDim
Geometry Constructors
NOTE: this function does not currently exist in Spatialite
Types
Affine Transforms
@spec transform(geometry :: GeoSQL.geometry_input(), srid :: pos_integer()) :: GeoSQL.fragment()
Data Formats
Geometry Accessors
@spec boundary(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec coord_dim(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
Note: this function takes an optional Ecto.Repo parameter due to some backends implementing the non-standard ST_NDims rather than ST_CoordDim
@spec curve_n(GeoSQL.geometry_input(), index :: integer() | GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec curve_to_line(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec dimension(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec end_point(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec envelope(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec geometry_n(GeoSQL.geometry_input(), index :: pos_integer()) :: GeoSQL.fragment()
@spec geometry_type(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec interior_ring_n(GeoSQL.geometry_input(), index :: pos_integer()) :: GeoSQL.fragment()
@spec is_closed(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec is_ring(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec is_simple(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec m(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec num_geometries(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec num_interior_rings(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec num_points(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec patch_n( GeoSQL.geometry_input(), face_index :: number() | GeoSQL.geometry_input() ) :: GeoSQL.fragment()
@spec point_n(GeoSQL.geometry_input(), index :: pos_integer()) :: GeoSQL.fragment()
@spec start_point(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec x(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec y(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec z(GeoSQL.geometry_input()) :: GeoSQL.fragment()
Geometry Constructors
@spec point(x :: number(), y :: number()) :: GeoSQL.fragment()
NOTE: this function does not currently exist in Spatialite
Geometry Editors
Geometry Processing
@spec buffer(GeoSQL.geometry_input(), radius :: number()) :: GeoSQL.fragment()
@spec buffer( GeoSQL.geometry_input(), radius :: number(), num_quarters_or_params :: number() | String.t() ) :: GeoSQL.fragment()
@spec centroid(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec convex_hull(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec point_on_surface(GeoSQL.geometry_input()) :: GeoSQL.fragment()
Geometry Validation
@spec is_valid(GeoSQL.geometry_input()) :: GeoSQL.fragment()
Linear Referencing
Measurement
@spec area(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec distance( GeoSQL.geometry_input(), GeoSQL.geometry_input(), in_meters :: boolean() ) :: GeoSQL.fragment()
@spec length(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec perimeter(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec perimeter( GeoSQL.geometry_input(), use_spheroid :: boolean() | GeoSQL.geometry_input() ) :: GeoSQL.fragment()
Overlays
Spatial Reference Systems
@spec srid(GeoSQL.geometry_input()) :: GeoSQL.fragment()
Topological Relationships
@spec contains(GeoSQL.geometry_input(), contains :: GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec crosses(GeoSQL.geometry_input(), GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec disjoint(GeoSQL.geometry_input(), GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec equals(GeoSQL.geometry_input(), GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec intersects(GeoSQL.geometry_input(), GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec ordering_equals(GeoSQL.geometry_input(), GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec overlaps(GeoSQL.geometry_input(), GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec relate(GeoSQL.geometry_input(), GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec relate( GeoSQL.geometry_input(), GeoSQL.geometry_input(), matrix_or_rule :: String.t() | boundary_node_rule() ) :: GeoSQL.fragment()
@spec touches(GeoSQL.geometry_input(), GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec within(GeoSQL.geometry_input(), GeoSQL.geometry_input()) :: GeoSQL.fragment()
Well-Known Binary (WKB)
@spec as_binary(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec geom_from_wkb(text :: binary(), srid :: integer()) :: GeoSQL.fragment()
@spec point_from_wkb(text :: binary(), srid :: integer()) :: GeoSQL.fragment()
Well-Known Text (WKT)
@spec as_text(GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec geom_collection_from_text(text :: binary(), srid :: integer()) :: GeoSQL.fragment()
@spec line_from_text(text :: String.t(), srid :: integer()) :: GeoSQL.fragment()
@spec line_from_text(text :: binary(), srid :: integer()) :: GeoSQL.fragment()
@spec m_line_from_text(text :: binary(), srid :: integer()) :: GeoSQL.fragment()
@spec m_point_from_text(text :: binary(), srid :: integer()) :: GeoSQL.fragment()
@spec m_poly_from_text(text :: binary(), srid :: integer()) :: GeoSQL.fragment()
@spec point_from_text(text :: binary(), srid :: integer()) :: GeoSQL.fragment()
@spec polygon_from_text(text :: binary(), srid :: integer()) :: GeoSQL.fragment()