# Solving coordinate differences between packages

I have two maps generated by two different methods. The first, I used maps package and the function map() and symbols(). On the other hand, I used the ggmap package with the ggmap() and geom_point() functions. This the structure of my data and my code:

``````# Capitalizing first letters
write.csv(locations, file = "locations.csv")

# Obtaining latitude & longitude
lonlat <- geocode(as.character(locations\$city))
``````

``````> str(city_frequency)
'data.frame':   144 obs. of  4 variables:
\$ city: Factor w/ 144 levels "A Coruna","Agen",..: 1 2 3 4 5 6 7 8 9 10 ...
\$ freq: int  7 2 4 1 4 2 1 1 1 5 ...
\$ lon : num  -8.412 0.616 -8.446 -4.262 2.149 ...
\$ lat : num  43.4 44.2 40.6 42.8 43.9 ...

xlim <- c(-13.08, 8.68)
ylim <- c(34.87, 49.50)
map("world", lwd=0.05, xlim=xlim, ylim=ylim)
symbols(city_frequency\$lon, city_frequency\$lat, circles=sqrt(city_frequency\$freq), bg="#93ceef", fg="#ffffff", lwd=0.5, inches=0.15, add=TRUE)

m <- get_map("France", zoom = 5, maptype = "toner")
ggmap(m) + geom_point(data = city_frequency, aes(lon = lon, lat = lat, size = sqrt(freq)), alpha = 0.7) + labs(x = "longitude", y = "latitude", title = "City Frequency")
``````

The thing is that in the second map all the points are located a little bit North from the right place.

How can I solve this problem?

Note: in order to get the coordinates of my data frame I used the geocode() -which I have added at the first lines of code- in a early step.

---> I have created a public repository in github in order that everyone can access my data frames. Feel free to play with them.

• Thanks Andre for your quickly response. I do not know how what you are asking. In ArcGIS and other GIS desktop software I know how to change projections but in R I am a rookie. Is there any function to give and change that information? In addition, I have created a public github repository with my data frames. I will edit my post and add the links. – ramiroaznar Nov 29 '14 at 11:37
• I have added the lines in relation to the geocode() steps. – ramiroaznar Nov 29 '14 at 12:26
• I don't think it is your geocoding. If you use `maptype = "terrain"` you will get a much better match. Something seems to be odd with the Stamen map, at least at those lower zoom levels. – cengel Nov 30 '14 at 18:59