-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathmap.rb
More file actions
43 lines (39 loc) · 1.42 KB
/
map.rb
File metadata and controls
43 lines (39 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# frozen_string_literal: true
module Strava
module Models
#
# Represents a map with polyline data for an activity, route, or segment.
#
# Maps contain encoded polyline data that represents the geographic path.
# The polyline format uses Google's encoded polyline algorithm which can
# be decoded using libraries like the 'polylines' gem.
#
# @example Decode and use polyline data
# require 'polylines'
#
# activity = client.activity(1234567890)
# map = activity.map
#
# # Decode the summary polyline
# decoded = Polylines::Decoder.decode_polyline(map.summary_polyline)
# start_point = decoded.first # [latitude, longitude]
# end_point = decoded.last
#
# # Use with Google Maps Static API
# url = "https://maps.googleapis.com/maps/api/staticmap?" \
# "path=enc:#{CGI.escape(map.summary_polyline)}&size=800x800"
#
# @see https://developers.google.com/maps/documentation/utilities/polylinealgorithm
#
class Map < Strava::Models::Response
# @return [String] Map identifier
property 'id'
# @return [String] Google polyline encoding of the route (lower resolution)
property 'summary_polyline'
# @return [Integer] Resource state indicator
property 'resource_state'
# @return [String] Google polyline encoding of the route (higher resolution)
property 'polyline'
end
end
end