-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathget_dennys.R
More file actions
38 lines (28 loc) · 1.1 KB
/
get_dennys.R
File metadata and controls
38 lines (28 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
key = "6B962D40-03BA-11E5-BC31-9A51842CA48B"
get_dennys_locs = function(dest, key, lat, long, radius, limit)
{
url = paste0(
"https://hosted.where2getit.com/dennys/responsive/ajax?&xml_request=",
"<request>",
"<appkey>",key ,'</appkey><formdata id="locatorsearch">',
"<dataview>store_default</dataview>",
"<limit>",limit,"</limit>",
"<order>rank,_distance</order>",
"<geolocs><geoloc><addressline></addressline>",
"<longitude>",long,"</longitude>",
"<latitude>",lat,"</latitude>",
"<country>US</country></geoloc></geolocs><stateonly>1</stateonly>",
"<searchradius>",radius,"</searchradius></formdata></request>")
download.file(url,destfile=dest,method = "wget")
}
locs = read.csv("dennys_coords.csv",header = FALSE)
dir.create("data/dennys/",recursive = TRUE,showWarnings = FALSE)
limit = 1000
for(i in 1:nrow(locs))
{
long = locs[i,1]
lat = locs[i,2]
radius = locs[i,3]
dest = paste0("data/dennys/",i,".xml")
get_dennys_locs(dest, key, lat, long, radius, limit)
}