So I am currently figuring out how to overlay a contour onto a map, so far I have this. Any help would be appreciated. Thanks in advance.
worldmap = getMap(resolution = "high")
NrthAm = worldmap[which(worldmap$REGION =="North America"),]
plot(NrthAm, xlim=c(-123.35,-122.65),
ylim=c(49,49.35), main = "Pokemon in Vancouver")
newnew = "CREATE VIEW location AS SELECT latitude, longitude FROM Vanpoke"
query1 = "SELECT latitude, longitude from location"
point = dbGetQuery(dbcon,query1)
kde = kde2d(point$longitude,point$latitude)
image(kde)
contour(kde)
Edit1: I added some sample data
latitude longitude
1 49.33597 -123.0458
2 49.27268 -122.8834
3 49.25722 -122.9652
4 49.30699 -123.0204
5 49.19668 -122.9262
6 49.33281 -123.0636
Edit2: I added a the density plot onto a map, but I am not sure if it is correct or not.