GeoSQL (GeoSQL v1.1.0)

View Source

GeoSQL provides access to GIS functions in SQL databases via Ecto. PostGIS 3.x and Spatialite are currently supported.

SQL functions are sorted into modules by their appearance in standards (e.g. SQL/MM2 vs SQL/MM3), category or topic (such as topological and 3D functions), as well as their availability in specific implementations. This includes the following modules:

  • GeoSQL.MM2: functions from the SQL/MM v2 standard
  • GeoSQL.MM3: functions from the SQL/MM v3 standard
  • GeoSQL.Common: non-standard functions that are widely available
  • GeoSQL.PostGIS: functions only found in PostGIS

This makes usage of feature sets self-documenting in the code, allowing developers to adopt or avoid functions that are not available in the databases the application uses.

Where there are subtle differences between implementations of the same functions, GeoSQL strives to hide those differences behind single function calls.

The GeoSQL.Geometry module provides access to geometric types in Ecto schemas.

Summary

Functions

Performs runtime setup of an Ecto repo for use with GeoSQL. This can be done in the repo's init/2 callback, or any time after it has been started. This function is idempotent.

Types

fragment()

@type fragment() :: term()

geometry_input()

@type geometry_input() :: GeoSQL.Geometry.t() | fragment()

init_option()

@type init_option() ::
  {:json, atom()}
  | {:decode_binary, :copy | :reference}
  | {:type_extensions, [module()]}

init_options()

@type init_options() :: [init_option()]

Functions

init(repo, opts \\ [json: Jason, decode_binary: :copy])

@spec init(Ecto.Repo.t(), init_options()) :: :ok

Performs runtime setup of an Ecto repo for use with GeoSQL. This can be done in the repo's init/2 callback, or any time after it has been started. This function is idempotent.

If using additional type extensions, pass those modules in via the type_extensions option.