GeoSQL.Geometry (GeoSQL v1.3.0)

View Source

Geometry types for use with ecto. Supported types include:

  • GeoSQL.Geometry, a catch-all type
  • GeoSQL.Geometry.Geopackage, a catch-all type for fields containing Geopackage geometry blobs
  • GeoSQL.Geometry.Point
  • GeoSQL.Geometry.PointZ
  • GeoSQL.Geometry.PointM
  • GeoSQL.Geometry.PointZM
  • GeoSQL.Geometry.LineString
  • GeoSQL.Geometry.LineStringZ
  • GeoSQL.Geometry.LineStringZM
  • GeoSQL.Geometry.Polygon
  • GeoSQL.Geometry.PolygonZ
  • GeoSQL.Geometry.MultiPoint
  • GeoSQL.Geometry.MultiPointZ
  • GeoSQL.Geometry.MultiLineString
  • GeoSQL.Geometry.MultiLineStringZ
  • GeoSQL.Geometry.MultiLineStringZM
  • GeoSQL.Geometry.MultiPolygon
  • GeoSQL.Geometry.MultiPolygonZ
  • GeoSQL.Geometry.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