GeoSQL.Geometry (GeoSQL v1.1.0)

View Source

Geometry types for use with ecto. Supported types include:

  • GeoSQL.Geometry, a catch-all type
  • GeoSQL.Geometry.Point
  • GeoSQLGeometry.PointZ
  • GeoSQLGeometry.PointM
  • GeoSQLGeometry.PointZM
  • GeoSQLGeometry.LineString
  • GeoSQLGeometry.LineStringZ
  • GeoSQLGeometry.LineStringZM
  • GeoSQLGeometry.Polygon
  • GeoSQLGeometry.PolygonZ
  • GeoSQLGeometry.MultiPoint
  • GeoSQLGeometry.MultiPointZ
  • GeoSQLGeometry.MultiLineString
  • GeoSQLGeometry.MultiLineStringZ
  • GeoSQLGeometry.MultiLineStringZM
  • GeoSQLGeometry.MultiPolygon
  • GeoSQLGeometry.MultiPolygonZ
  • GeoSQLGeometry.GeometryCollection

Example:

defmodule MyApp.GeoTable do
  use Ecto.Schema

  schema "specified_columns" do
    field(:name, :string)
    field(:geometry, GeoSQL.Geometry) # will match any Geo type
    field(:point, GeoSQL.Geometry.Point) # will reject any non-Point data
    field(:linestring, GeoSQL.Geometry.LineStringZ) # will reject any non-LineStringZ data
  end
end

Summary

Functions

Returns the matching Geometry type for a geometry type returned from the database

Types

t()

@type t() :: Geometry.t()

Functions

from_db_type(db_type)

@spec from_db_type(db_type :: String.t()) :: t()

Returns the matching Geometry type for a geometry type returned from the database