From d89ccbca3c50470d34121b967e38330545878aa8 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 31 May 2023 13:51:01 -0400 Subject: [PATCH] feat: add map_id parameter to static map request (#270) * feat: add map_id parameter to static map request * feat: add mapid argument to static map cmdline app --- examples/staticmap/cmdline/main.go | 2 ++ staticmap.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/examples/staticmap/cmdline/main.go b/examples/staticmap/cmdline/main.go index defb072..42f77ff 100644 --- a/examples/staticmap/cmdline/main.go +++ b/examples/staticmap/cmdline/main.go @@ -37,6 +37,7 @@ var ( scale = flag.Int("scale", -1, "Scale affects the number of pixels that are returned.") format = flag.String("format", "", "Format defines the format of the resulting image.") maptype = flag.String("maptype", "", "Maptype defines the type of map to construct.") + mapid = flag.String("mapid", "", "MapId defines the mapid to use.") language = flag.String("language", "", "Language defines the language to use for display of labels on map tiles.") region = flag.String("region", "", "Region the appropriate borders to display, based on geo-political sensitivities.") ) @@ -81,6 +82,7 @@ func main() { Language: *language, Region: *region, MapType: maps.MapType(*maptype), + MapId: *mapid, } resp, err := client.StaticMap(context.Background(), r) diff --git a/staticmap.go b/staticmap.go index 56d684f..ac87d6a 100644 --- a/staticmap.go +++ b/staticmap.go @@ -253,6 +253,8 @@ type StaticMapRequest struct { Region string // MapType (optional) defines the type of map to construct. MapType MapType + // MapId (optional) defines the identifier for a specific map. + MapId string // Markers (optional) define one or more markers to attach to the image at specified // locations. Markers []Marker @@ -296,6 +298,9 @@ func (r *StaticMapRequest) params() url.Values { if r.MapType != "" { q.Set("maptype", string(r.MapType)) } + if r.MapId != "" { + q.Set("map_id", r.MapId) + } for _, m := range r.Markers { q.Add("markers", m.String())