-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
Hey, I have the following definitions:
# Model
schema "places" do
field :name, :binary
field :location, Geo.PostGIS.Geometry
end
def changeset(struct \\ %__MODULE__{}, attrs) do
struct
|> cast(attrs, @fields)
|> validate_required(@fields)
end
My migration:
create table("places") do
add :name, :binary
add :location, :geometry
end
And I try to use it as follows:
google_maps_srid = 3857
location = %Geo.Point{coordinates: {50.091211805442974, 19.89650102357312}, srid: google_maps_srid}
%{name: "name", location: location}
|> Place.changeset()
|> Repo.insert()
I get the following error:
(Postgrex.Error) ERROR 22023 (invalid_parameter_value) Only lon/lat coordinate systems are supported in geography.
And insert log:
21:54:17.882 [debug] QUERY ERROR db=38.5ms queue=4.3ms
INSERT INTO "places" ("location","name") VALUES ($1,$2) RETURNING "id" [%Geo.Point{coordinates: {50.091211805442974, 19.89650102357312}, properties: %{}, srid: 3857}, "Some name"]
It looks like somewhere along the way the geometry type is treated as geography but I fail at understanding where. Any help would be appreciated.
Metadata
Metadata
Assignees
Labels
No labels