I'm trying to set up Postgis with Ecto, i've been following the documentation of https://github.com/bryanjos/geo_postgis closely. But when trying to retrieve a resource that has the following field
field :coords, {:array, Geo.PostGIS.Geometry}, default: []
I get the following error
[error] #PID<0.1405.0> running GIWeb.Endpoint (connection #PID<0.1404.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /c/applications/power/community_map
** (exit) an exception was raised:
** (Postgrex.QueryError) type `_geometry` can not be handled by the types module GI.PostgresTypes
(ecto_sql 3.4.5) lib/ecto/adapters/sql.ex:593: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto_sql 3.4.5) lib/ecto/adapters/sql.ex:526: Ecto.Adapters.SQL.execute/5
(ecto 3.4.6) lib/ecto/repo/queryable.ex:192: Ecto.Repo.Queryable.execute/4
(ecto 3.4.6) lib/ecto/repo/queryable.ex:17: Ecto.Repo.Queryable.all/3
(elixir 1.11.1) lib/enum.ex:1399: Enum."-map/2-lists^map/1-0-"/2
(app 0.1.0) lib/app/plugs/auth.ex:30: GIWeb.Plugs.Auth.put_context/2
(app 0.1.0) GIWeb.Router.browser/2
(app 0.1.0) lib/app/router.ex:1: GIWeb.Router.__pipe_through3__/1
(phoenix 1.5.4) lib/phoenix/router.ex:347: Phoenix.Router.__call__/2
(app 0.1.0) lib/app/endpoint.ex:1: GIWeb.Endpoint.plug_builder_call/2
(app 0.1.0) lib/plug/debugger.ex:132: GIWeb.Endpoint."call (overridable 3)"/2
(app 0.1.0) lib/app/endpoint.ex:1: GIWeb.Endpoint.call/2
(phoenix 1.5.4) lib/phoenix/endpoint/cowboy2_handler.ex:65: Phoenix.Endpoint.Cowboy2Handler.init/4
(cowboy 2.8.0) /home/elvar/Projects/elixir/platform/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
I have defined my types.
Postgrex.Types.define(
GI.PostgresTypes,
[Geo.PostGIS.Extension] ++ Ecto.Adapters.Postgres.extensions(),
json: Jason
)
Added my field in a migration
add :coords, {:array, :geometry}, default: []
What am i doing wrong?