GeoSQL.Common (GeoSQL v1.2.0)
View SourceCommonly supported, but non-standard, GIS SQL functions. These are found in multiple database implementations, though they may differ in minor syntactical details in each implementation.
Implementation differences
In cases where the generated SQL differs based on the database in use, those
functions will take an optional Ecto.Repo
argument. When provided, this allows
the function to decide which implementation-specific ipmlementation to use.
When no Ecto.Repo
is provided, functions default to PostGIS
-compatible syntax.
Database support
The features in the GeoSQL.Common
modules are intended to contain functions
available in all support SQL GIS extensions.
Some backends may require special initialization or dependencies loaded for some of these functions to work. For example, SpatiaLite must be built with the GEO package for some of these functions to be available.
Consult the documentation for the database GIS extension being used for such requirements.
Summary
Data Formats
Passing an srid of 0 (the default) will not set an srid on the results. It is ignored for Spatialite in all cases.
Linear Referencing
Spatialite does not support spheroid calculations, and therefore use_spheroid?
is ignored
on that platform.
Note that Spatialite does not support spheroid calculations.
Spatialite does not support spheroid calculations, and therefore use_spheroid?
is ignored
on that platform.
Affine Transformations
@spec scale( GeoSQL.geometry_input(), scale_x :: number(), scale_y :: number(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
Bounding Boxes
@spec estimated_extent( table :: String.t() | {schema :: String.t(), table :: String.t()}, column :: String.t(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
@spec expand( geometry :: GeoSQL.geometry_input(), units_to_expand :: number() ) :: GeoSQL.fragment()
@spec extent(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
@spec max_coord(GeoSQL.geometry_input(), axis :: :x | :y | :z, Ecto.Repo.t() | nil) :: GeoSQL.fragment()
@spec min_coord(GeoSQL.geometry_input(), axis :: :x | :y | :z, Ecto.Repo.t() | nil) :: GeoSQL.fragment()
Coverages
Data Formats
@spec as_geojson(geometry :: GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
@spec as_gml( geometry :: GeoSQL.geometry_input(), gml_version :: 2 | 3, precision :: pos_integer(), Ecto.Repo.t() ) :: GeoSQL.fragment()
@spec as_kml( geometry :: GeoSQL.geometry_input(), precision :: pos_integer(), name :: String.t(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
@spec geom_from_geojson( geojson :: GeoSQL.geometry_input() | String.t(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
@spec geom_from_gml( gml :: GeoSQL.geometry_input() | String.t(), srid :: non_neg_integer(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
Passing an srid of 0 (the default) will not set an srid on the results. It is ignored for Spatialite in all cases.
@spec geom_from_kml(kml :: GeoSQL.geometry_input() | String.t(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
Geometry Accessors
@spec is_polygon_clockwise(geometry :: GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec is_polygon_counter_clockwise(geometry :: GeoSQL.geometry_input()) :: GeoSQL.fragment()
Geometry Constructors
@spec make_point( x :: [GeoSQL.fragment()] | [number()], y :: [GeoSQL.fragment()] | [number()], Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
@spec make_point_m( x :: [GeoSQL.fragment()] | [number()], y :: [GeoSQL.fragment()] | [number()], z :: [GeoSQL.fragment()] | [number()], Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
@spec make_point_z( x :: [GeoSQL.fragment()] | [number()], y :: [GeoSQL.fragment()] | [number()], z :: [GeoSQL.fragment()] | [number()], Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
@spec make_point_zm( x :: [GeoSQL.fragment()] | [number()], y :: [GeoSQL.fragment()] | [number()], z :: [GeoSQL.fragment()] | [number()], m :: [GeoSQL.fragment()] | [number()], Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
Geometry Editors
@spec add_point( line :: GeoSQL.geometry_input(), point :: GeoSQL.geometry_input(), position :: integer() ) :: GeoSQL.fragment()
@spec collection_extract( collection :: GeoSQL.geometry_input(), type :: :point | :line_string | :polygon ) :: GeoSQL.fragment()
@spec multi(geometry :: GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec project( geometry :: GeoSQL.geometry_input(), distance :: number(), azimuth :: number() ) :: GeoSQL.fragment()
@spec remove_point(line :: GeoSQL.geometry_input(), offset :: integer()) :: GeoSQL.fragment()
@spec remove_repeated_points( GeoSQL.geometry_input(), tolerance :: number(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
@spec reverse(geometry :: GeoSQL.geometry_input()) :: GeoSQL.fragment()
@spec segmentize(geometry :: GeoSQL.geometry_input(), max_segement_length :: number()) :: GeoSQL.fragment()
@spec set_point( geometry :: GeoSQL.geometry_input(), index :: integer(), point :: GeoSQL.geometry_input() ) :: GeoSQL.fragment()
@spec snap_to_grid(GeoSQL.geometry_input(), size :: number()) :: GeoSQL.fragment()
@spec snap_to_grid( GeoSQL.geometry_input(), reference :: GeoSQL.geometry_input(), precision :: number() ) :: GeoSQL.fragment()
@spec snap_to_grid(GeoSQL.geometry_input(), size_x :: number(), size_y :: number()) :: GeoSQL.fragment()
@spec snap_to_grid( GeoSQL.geometry_input(), origin_x :: number(), origin_y :: number(), size_x :: number(), size_y :: number() ) :: GeoSQL.fragment()
@spec snap_to_grid( GeoSQL.geometry_input(), point :: GeoSQL.geometry_input(), size_x :: number(), size_y :: number(), size_z :: number(), size_m :: number() ) :: GeoSQL.fragment()
Geometry Mutations
@spec flip_coordinates(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
@spec shift_longitude(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
Geometry Processing
@spec concave_hull( GeoSQL.geometry_input(), precision :: number(), allow_holes? :: boolean() ) :: GeoSQL.fragment()
@spec largest_empty_circle( GeoSQL.geometry_input(), tolerance :: number(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
@spec line_merge(GeoSQL.geometry_input(), directed? :: boolean(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
@spec maximum_inscribed_circle(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
@spec minimum_bounding_circle(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
@spec minimum_bounding_radius(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
@spec triangulate_polygon(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
Geometry Validation
@spec is_valid_detail(geometry :: GeoSQL.geometry_input(), esri_compat? :: boolean()) :: GeoSQL.fragment()
@spec is_valid_reason(geometry :: GeoSQL.geometry_input(), esri_compat? :: boolean()) :: GeoSQL.fragment()
Linear Referencing
@spec add_measure( line :: GeoSQL.geometry_input(), measure_start :: number(), measure_end :: number() ) :: GeoSQL.fragment()
@spec interpolate_point( line :: GeoSQL.geometry_input(), point :: GeoSQL.geometry_input() ) :: GeoSQL.fragment()
@spec line_interpolate_point( line :: GeoSQL.geometry_input(), fraction :: number(), use_spheroid? :: boolean(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
Spatialite does not support spheroid calculations, and therefore use_spheroid?
is ignored
on that platform.
@spec line_interpolate_points( line :: GeoSQL.geometry_input(), fraction :: number(), use_spheroid? :: boolean(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
Note that Spatialite does not support spheroid calculations.
@spec line_locate_point( line :: GeoSQL.geometry_input(), point :: GeoSQL.geometry_input(), use_spheroid? :: boolean(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
Spatialite does not support spheroid calculations, and therefore use_spheroid?
is ignored
on that platform.
@spec line_substring( line :: GeoSQL.geometry_input() | GeoSQL.fragment(), start_fraction :: number(), end_fraction :: number(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
@spec locate_along(GeoSQL.geometry_input(), measure :: number()) :: GeoSQL.fragment()
@spec locate_between( GeoSQL.geometry_input(), measure_start :: number(), measure_end :: number() ) :: GeoSQL.fragment()
Measurement
@spec closest_point( GeoSQL.geometry_input(), GeoSQL.geometry_input(), use_spheroid? :: boolean(), Ecto.Repo.t() ) :: GeoSQL.fragment()
@spec shortest_line( GeoSQL.geometry_input(), GeoSQL.geometry_input(), use_spheroid? :: boolean(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
Overlays
Spatial Reference Systems
@spec set_srid( geometry :: GeoSQL.geometry_input(), srid :: pos_integer(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
@spec transform_pipeline( GeoSQL.geometry_input(), pipeline :: String.t(), srid :: pos_integer(), Ecto.Repo.t() | nil ) :: GeoSQL.fragment()
Topology Relationships
Well-Known Binary (WKB)
@spec as_ewkb(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
@spec geom_from_ewkb(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
Well-Known Text (WKT)
@spec as_ewkt(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()
@spec bd_m_poly_from_text( String.t() | GeoSQL.geometry_input(), pos_integer() | GeoSQL.geometry_input() ) :: GeoSQL.fragment()
@spec bd_poly_from_text( String.t() | GeoSQL.geometry_input(), pos_integer() | GeoSQL.geometry_input() ) :: GeoSQL.fragment()
@spec geom_from_ewkt(GeoSQL.geometry_input(), Ecto.Repo.t() | nil) :: GeoSQL.fragment()