diff --git a/lib/geo_postgis/geometry.ex b/lib/geo_postgis/geometry.ex index d04e5c1..777c857 100644 --- a/lib/geo_postgis/geometry.ex +++ b/lib/geo_postgis/geometry.ex @@ -19,6 +19,7 @@ if Code.ensure_loaded?(Ecto.Type) do @types [ "Point", + "PointZ", "LineString", "Polygon", "MultiPoint", diff --git a/mix.exs b/mix.exs index 03a9458..655789d 100644 --- a/mix.exs +++ b/mix.exs @@ -36,7 +36,7 @@ defmodule GeoPostgis.Mixfile do defp deps do [ - {:geo, "~> 3.0"}, + {:geo, "~> 3.1"}, {:postgrex, "~> 0.14"}, {:ex_doc, "~> 0.19.1", only: :dev}, {:ecto_sql, "~> 3.0", optional: true, only: :test}, diff --git a/test/geo_postgis_test.exs b/test/geo_postgis_test.exs index da491c6..70faa76 100644 --- a/test/geo_postgis_test.exs +++ b/test/geo_postgis_test.exs @@ -48,6 +48,18 @@ defmodule Geo.PostGIS.Test do assert(result.rows == [[42, "test", geo]]) end + test "insert pointz", context do + pid = context[:pid] + geo = %Geo.PointZ{coordinates: {30, -90, 70}, srid: 4326} + + {:ok, _} = + Postgrex.query(pid, "CREATE TABLE point_test (id int, geom geometry(PointZ, 4326))", []) + + {:ok, _} = Postgrex.query(pid, "INSERT INTO point_test VALUES ($1, $2)", [42, geo]) + {:ok, result} = Postgrex.query(pid, "SELECT * FROM point_test", []) + assert(result.rows == [[42, geo]]) + end + test "insert linestring", context do pid = context[:pid] geo = %Geo.LineString{srid: 4326, coordinates: [{30, 10}, {10, 30}, {40, 40}]}