dkahle / dkahle/ggmap

Multiple Style Arguments Not Working Correctly

Open
#138 0 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
R
Stars
778
Forks
234
PR merge metrics
No merged PRs in 30d

Description

See the discussion [here](http://stackoverflow.com/questions/41049782/making-multiple-style-references-in-google-maps-api/41051499?noredirect=1#comment69422098_41051499) on SO, but the gist is that the documentation leads you to believe you can pass a list of style arguments to `ggmap()`, however you are thrown errors and incorrectly generated urls when using a list of style arguments or concatenation.

Rather, you need to create your second, and subsequent style requests, beginning with "&style=" so that the url is generated correctly.

```
style1 <- c(feature = "poi.medical", element = "geometry", color = "red")
style2 <- c("&style=", feature = "poi.park", element = "geometry", color = "blue")

style <- c(style1, style2)

map <- get_googlemap("new york city",
zoom = 12,
maptype = "roadmap",
style = style)

plot(map)
```

All credit goes to SymbolixAU on Stack Overflow for finding a solution to this issue.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the get_googlemap() entry point and reproduce the issue with the style1/style2 example in the report. Inspect how the style argument is converted into the generated URL, then verify that multiple style requests no longer cause errors or malformed URLs and that the example plots successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
api, data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.