mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Add osm_id, osm_key, osm_value, osm_type to places
This commit is contained in:
parent
d78482f1bf
commit
43c7e64efb
3 changed files with 20 additions and 3 deletions
|
|
@ -31,4 +31,20 @@ class Place < ApplicationRecord
|
|||
def reverse_geocoded?
|
||||
geodata.present?
|
||||
end
|
||||
|
||||
def osm_id
|
||||
geodata['properties']['osm_id']
|
||||
end
|
||||
|
||||
def osm_key
|
||||
geodata['properties']['osm_key']
|
||||
end
|
||||
|
||||
def osm_value
|
||||
geodata['properties']['osm_value']
|
||||
end
|
||||
|
||||
def osm_type
|
||||
geodata['properties']['osm_type']
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ module Visits
|
|||
class Detector
|
||||
MINIMUM_VISIT_DURATION = 3.minutes
|
||||
MAXIMUM_VISIT_GAP = 30.minutes
|
||||
MINIMUM_POINTS_FOR_VISIT = 3
|
||||
MINIMUM_POINTS_FOR_VISIT = 2
|
||||
|
||||
attr_reader :points
|
||||
|
||||
|
|
@ -57,7 +57,8 @@ module Visits
|
|||
# Calculate distance from visit center
|
||||
distance = Geocoder::Calculations.distance_between(
|
||||
[visit[:center_lat], visit[:center_lon]],
|
||||
[point.lat, point.lon]
|
||||
[point.lat, point.lon],
|
||||
units: :km
|
||||
)
|
||||
|
||||
# Dynamically adjust radius based on visit duration
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ module Visits
|
|||
|
||||
{
|
||||
main_place: main_place,
|
||||
suggested_places: all_suggested_places.uniq { |place| place.name }
|
||||
suggested_places: all_suggested_places.uniq(&:name)
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue