Karthik Suresh
Karthik Suresh

Reputation: 71

Error while creating a new york city map with get_map Function

I have been trying to plot a map of locations of different types of buildings that consume natural gas in the New York city

I tried to download the map of New York with get_map function

map <- get_map(location ="New York", maptype = "terrain",
         source='google',color='color')

When I try this I keep getting this error

Error in data.frame(ll.lat = ll[1], ll.lon = ll[2], ur.lat = ur[1], ur.lon = ur[2]) : arguments imply differing number of rows: 0, 1

How do I retify this error?

I also tried to use latitude and longitude locations doesn't seem to work either

Upvotes: 1

Views: 897

Answers (2)

ManuelVillamil
ManuelVillamil

Reputation: 87

I had the same problem in my R and even using the line if

(exists('.GeocodedInformation')) rm(.GeocodedInformation)

it didn't work.

However, the solution to this problem was to run immediately before of the Knitr, the chunk of the getmap.

Upvotes: 0

karlos
karlos

Reputation: 893

I had this problem for a long time. Drove me nuts. Sometimes it worked by itself, sometimes it didn't. Even after updating all the packages. I was using rmarkdown with caching enabled.

I think I found the issue. It is due to caching in the hidden object .GeocodedInformation.

Now I placed this before my code and I don't see the error anymore:

if (exists('.GeocodedInformation')) rm(.GeocodedInformation)

Upvotes: 1

Related Questions