Introduce Mimirsbrunn geocoder and improve addresses & maps

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-11-08 19:37:14 +01:00
parent 0e7cf89492
commit c599a47d58
36 changed files with 940 additions and 267 deletions

View File

@@ -1,6 +1,6 @@
defmodule Mobilizon.Service.Geospatial.GoogleMaps do
@moduledoc """
Google Maps [Geocoding service](https://developers.google.com/maps/documentation/geocoding/intro).
Google Maps [Geocoding service](https://developers.google.com/maps/documentation/geocoding/intro). Only works with addresses.
Note: Endpoint is hardcoded to Google Maps API.
"""
@@ -89,7 +89,11 @@ defmodule Mobilizon.Service.Geospatial.GoogleMaps do
url <> "&address=#{args.q}"
:geocode ->
url <> "&latlng=#{args.lat},#{args.lon}&result_type=street_address"
zoom = Keyword.get(options, :zoom, 15)
result_type = if zoom >= 15, do: "street_address", else: "locality"
url <> "&latlng=#{args.lat},#{args.lon}&result_type=#{result_type}"
:place_details ->
"https://maps.googleapis.com/maps/api/place/details/json?key=#{api_key}&placeid=#{