Fix federating geo coordinates
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
7c71e9e04f
commit
cc197d7638
@ -36,15 +36,16 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Address do
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_nil(object["latitude"]) or is_nil(object["longitude"]) do
|
latitude = Map.get(object, "latitude")
|
||||||
res
|
longitude = Map.get(object, "longitude")
|
||||||
else
|
|
||||||
geo = %Geo.Point{
|
|
||||||
coordinates: {object["longitude"], object["latitude"]},
|
|
||||||
srid: 4326
|
|
||||||
}
|
|
||||||
|
|
||||||
Map.put(res, "geom", geo)
|
if is_float(latitude) and is_float(longitude) do
|
||||||
|
Map.put(res, "geom", %Geo.Point{
|
||||||
|
coordinates: {longitude, latitude},
|
||||||
|
srid: 4326
|
||||||
|
})
|
||||||
|
else
|
||||||
|
res
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -72,8 +73,8 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Address do
|
|||||||
res
|
res
|
||||||
else
|
else
|
||||||
res
|
res
|
||||||
|> Map.put("longitude", address.geom.coordinates |> elem(1))
|
|> Map.put("longitude", address.geom.coordinates |> elem(0))
|
||||||
|> Map.put("latitude", address.geom.coordinates |> elem(0))
|
|> Map.put("latitude", address.geom.coordinates |> elem(1))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user