Skip to content

Commit

Permalink
rename things a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
bastienboutonnet committed Feb 27, 2021
1 parent 1b77e6f commit e66ba7f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions macros/geo/haversine_distance.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ The arguments should be float type.
#}

{% macro haversine_distance(lat1,lon1,lat2,lon2,unit='mi') -%}

{{ return(adapter.dispatch('haversine_distance', packages = dbt_utils._get_utils_namespaces())(lat1,lon1,lat2,lon2,unit)) }}

{% endmacro %}

{% macro default__haversine_distance(lat1,lon1,lat2,lon2,unit='km') -%}
Expand All @@ -22,6 +20,6 @@ The arguments should be float type.

2 * 3961 * asin(sqrt((sin(radians(({{lat2}} - {{lat1}}) / 2))) ^ 2 +
cos(radians({{lat1}})) * cos(radians({{lat2}})) *
(sin(radians(({{lon2}} - {{lon1}}) / 2))) ^ 2)) {{conversion}}
(sin(radians(({{lon2}} - {{lon1}}) / 2))) ^ 2)) {{conversion_rate}}

{%- endmacro %}

0 comments on commit e66ba7f

Please sign in to comment.