Skip to content

Commit

Permalink
feat: add map_id parameter to static map request (#270)
Browse files Browse the repository at this point in the history
* feat: add map_id parameter to static map request

* feat: add mapid argument to static map cmdline app
  • Loading branch information
rockaport committed May 31, 2023
1 parent b5dfd38 commit d89ccbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/staticmap/cmdline/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
)
Expand Down Expand Up @@ -81,6 +82,7 @@ func main() {
Language: *language,
Region: *region,
MapType: maps.MapType(*maptype),
MapId: *mapid,
}

resp, err := client.StaticMap(context.Background(), r)
Expand Down
5 changes: 5 additions & 0 deletions staticmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit d89ccbc

Please sign in to comment.