From 53b6edb747cba22ab2a4d6b9e6b2821170165cfe Mon Sep 17 00:00:00 2001 From: Florian Gerhardt Date: Thu, 7 Feb 2019 12:41:50 +0100 Subject: [PATCH 1/2] Add PointZ handling --- lib/geo_postgis/geometry.ex | 1 + test/geo_postgis_test.exs | 12 ++++++++++++ 2 files changed, 13 insertions(+) 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/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}]} From d09cf9128b9c3b22553a097413f3b2a53598e6dd Mon Sep 17 00:00:00 2001 From: Florian Gerhardt Date: Fri, 8 Feb 2019 19:26:27 +0100 Subject: [PATCH 2/2] Update geo to 3.1 --- mix.exs | 2 +- mix.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/mix.lock b/mix.lock index 7780529..059f2a6 100644 --- a/mix.lock +++ b/mix.lock @@ -6,7 +6,7 @@ "ecto": {:hex, :ecto, "3.0.6", "d33ab5b3f7553a41507d4b0ad5bf192d533119c4ad08f3a5d63d85aa12117dc9", [:mix], [{:decimal, "~> 1.6", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm"}, "ecto_sql": {:hex, :ecto_sql, "3.0.4", "e7a0feb0b2484b90981c56d5cd03c52122c1c31ded0b95ed213b7c5c07ae6737", [:mix], [{:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.0.6", [hex: :ecto, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.9.1", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.14.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.3.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"}, "ex_doc": {:hex, :ex_doc, "0.19.1", "519bb9c19526ca51d326c060cb1778d4a9056b190086a8c6c115828eaccea6cf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.7", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"}, - "geo": {:hex, :geo, "3.0.0", "bb1e9baac6031c5bbddcde4937af1c1ab1cbfbbe2f7870038fdfc93a9cad4359", [:mix], [], "hexpm"}, + "geo": {:hex, :geo, "3.1.0", "727e005262430d037e870ff364e65d80ca5ca21d5ac8eddd57a1ada72c3f83b0", [:mix], [], "hexpm"}, "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"}, "makeup": {:hex, :makeup, "0.5.5", "9e08dfc45280c5684d771ad58159f718a7b5788596099bdfb0284597d368a882", [:mix], [{:nimble_parsec, "~> 0.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"}, "makeup_elixir": {:hex, :makeup_elixir, "0.10.0", "0f09c2ddf352887a956d84f8f7e702111122ca32fbbc84c2f0569b8b65cbf7fa", [:mix], [{:makeup, "~> 0.5.5", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},