Help with geocode() & get_map() please

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with geocode() & get_map() please

R-sig-geo mailing list
Hello:

#RStudio Version Version 1.2.1335
sessionInfo()
# R version 4.0.0 Patched (2020-05-03 r78349)
#Platform: x86_64-w64-mingw32/x64 (64-bit)
#Running under: Windows 10 x64 (build 17763)

library(ggmap)
library(sp)
library(rgdal)
library(rgeos)


I am trying to follow along with this stack-reference and recreate the recommended solution, then apply my data
https://gis.stackexchange.com/questions/133693/geographic-heatmaps-with-concentric-circles-by-distance?rq=1


I hope I have provided enough information below to reproduce or identify my errors.

Thank you for any assistance.

1. I am having trouble with geocode()

nyc <- geocode("New York")
No such file or directory failed to load external entity "http://maps.google.com/maps/api/geocode/xml?address=New+York&sensor=false"
Error : 1: No such file or directory2: failed to load external entity "http://maps.google.com/maps/api/geocode/xml?address=New+York&sensor=false"
Error in .geocode(xx$place, oneRecord = oneRecord, extent = extent, progress = progress) :
  object 'doc' not found


AND


2. I am having trouble with get_map()

ny.map <- get_map("New York", zoom = 8)

Source : https://maps.googleapis.com/maps/api/staticmap?center=New%20York&zoom=8&size=640x640&scale=2&maptype=terrain&language=en-EN&key=[012819-836529-634EA5]
Error in aperm.default(map, c(2, 1, 3)) :
invalid first argument, must be an array
In addition: Warning message:
In get_googlemap(center = location, zoom = zoom, maptype = maptype,  :
  HTTP 400 Bad Request

I have researched these errors and still do not seem to understand what I am doing wrong, or missing?

I have an API key and I believe I have initiated it correctly

I found this reference or a similar problem and followed the advice provided.
https://cran.r-project.org/web/packages/ggmap/ggmap.pdf


As suggested I went out to https://console.cloud.google.com/
and initiated suggested API's.

I manage to get through the next steps:

#create the circles with gBuffer and then reproject them into WGS84 for ggmap.

# create spatialPoint object
coordinates(clus3) <- ~ lon + lat
proj4string(clus3) <- CRS("+init=epsg:4326")


# reproject to Google Mercator (meters)
clus3.mrc <- spTransform(clus3, CRS = CRS("+init=epsg:3857"))

# concentric rings (in miles):
dist.miles <-  seq(15, 25, 30)

# create a dataframe with the circle coordinates function
circ.df <- do.call(rbind,
                   lapply(dist.miles, function(n) {
                     circ <- gBuffer(clus3.mrc, width = n * 1609.344, quadsegs=20)
                     circ.wgs <- spTransform(circ, CRS=CRS("+init=epsg:4326"))
                     coords <- lapply(circ.wgs@polygons, function(x) {x@Polygons[[1]]@coords})
                     data.frame(x=coords[[1]][,1], y=coords[[1]][,2], distance=n)
                   }))

# text positions
text.pos <- cbind(aggregate( y ~ distance, data=circ.df, FUN=min), x=clus3$lon, row.names = NULL)


# fake a heatmap
set.seed(1)
xy2 <- data.frame(x=runif(100, -74.5, -73.5),y=runif(100, 40.2, 41.2))


But I can get no further at this point due to get_map():

# get basemap
#ny.map <- get_map("New York", zoom = 8) https://cran.r-project.org/web/packages/ggmap/ggmap.pdf
#Source : https://maps.googleapis.com/maps/api/staticmap?center=New%20York&zoom=8&size=640x640&scale=2&maptype=terrain&language=en-EN&key=[012819-836529-634EA5]
Error in aperm.default(map, c(2, 1, 3)) :
  invalid first argument, must be an array
In addition: Warning message:
In get_googlemap(center = location, zoom = zoom, maptype = maptype,  :
  HTTP 400 Bad Request

I tried to use this in the plot below and of course it errors out --#Error: ggmap plots objects of class ggmap, see ?get_map
ny.map <- ggplot2::map_data("state", region = c('new york', 'new jersey'))

ny.map <- get_map("state", region = c('new york', 'new jersey'))
#ERROR:
Source : https://maps.googleapis.com/maps/api/staticmap?center=state&zoom=10&size=640x640&scale=2&maptype=terrain&language=en-EN&key=[012819-836529-634EA5]
Error in aperm.default(map, c(2, 1, 3)) :
  invalid first argument, must be an array
In addition: Warning message:
In get_googlemap(center = location, zoom = zoom, maptype = maptype,  :
  HTTP 400 Bad Request

# ny.map <- map('state', region = c('new york', 'new jersey'),
#     xlim=c(-74.12,-73.85), ylim=c(40.58,40.87))


# plot
ggmap(ny.map) +
  stat_density2d(data=xy2, mapping=aes(x=x, y=y, fill=..level..), geom="polygon", alpha=0.2) +
  scale_fill_gradient(low = "blue", high = "red") +
  geom_path(data=circ.df, aes(x=x, y=y, group=distance), alpha=0.5) +
  geom_text(data=text.pos, aes(x=x, y=y, label=paste0(distance,"mi")))
#Error: ggmap plots objects of class ggmap, see ?get_map


#Here is the dataset I would like to use in the solution provided by this reference
https://gis.stackexchange.com/questions/133693/geographic-heatmaps-with-concentric-circles-by-distance?rq=1

dput(clus3)
new("SpatialPointsDataFrame", data = structure(list(ID = c(3L,
57L, 87L, 141L, 173L, 286L, 287L, 335L, 553L, 574L, 598L, 634L,
653L, 661L, 676L, 683L, 684L, 687L, 732L, 742L, 753L, 779L, 785L,
793L, 798L, 799L, 838L, 902L, 903L, 904L, 910L, 912L, 993L, 1022L,
1048L, 1290L, 1410L, 1414L, 1429L, 1465L, 1507L, 1518L, 1520L,
1539L, 1546L, 1695L, 1760L, 1767L, 1769L, 1820L, 1876L, 1887L,
1903L, 1928L, 1958L, 2062L, 2063L, 2084L, 2157L, 2230L, 2263L,
2337L, 2339L), city = structure(c(230L, 152L, 1323L, 152L, 152L,
152L, 823L, 1140L, 152L, 1140L, 152L, 1140L, 152L, 152L, 1140L,
152L, 152L, 152L, 1140L, 152L, 152L, 823L, 823L, 152L, 152L,
152L, 345L, 1140L, 823L, 152L, 152L, 1140L, 990L, 152L, 1140L,
1140L, 1140L, 152L, 1323L, 1140L, 1140L, 1140L, 75L, 1140L, 1140L,
1140L, 823L, 1140L, 152L, 152L, 152L, 152L, 152L, 1140L, 152L,
562L, 152L, 1140L, 1140L, 1140L, 152L, 152L, 152L), .Label = c("ABBOTTSTOWN",
"ABILENE", "ACWORTH", "ADAMS", "ADDISON", "ADKINS", "ALBANY",
"ALBIA", "ALBUQUERQUE", "ALEXANDRIA", "ALFRED", "ALIQUIPPA",
"ALISO VIEJO", "ALLEN PARK", "ALLENTOWN", "ALPHA", "ALPHARETTA",
"ALPINE", "ALTOONA", "AMARILLO", "AMBLER", "AMBRIDGE", "AMHERST",
"AMITYVILLE", "ANAHIEM", "ANDERSON", "ANDOVER", "ANGIER", "ANGLETON",
"ANKENY", "ANN ARBOR", "ANZA", "APEX", "APOLLO", "ARCADIA", "ARCHDALE",
"ARDMORE", "ARGYLE", "ARKANSAS CITY", "ARLINGTON", "ARNOLD",
"ARTHUR", "ASHEBORO", "ASHEVILLE", "ASHLAND", "ASHLAND CITY",
"ASHTON", "ASTON", "ATHENS", "ATLANTA", "ATLANTIC BCH", "AUBORN",
"AUGUSTA", "AURORA", "AUSTELL", "AUSTIN", "AVENTURA", "AVONDALE ESTATES",
"BAKERSFIELD", "BALDWIN CITY", "BALDWIN PLACE", "BALLWIN", "BANGOR",
"BARBOURSVILLE", "BARNEGAT", "BARTLETT", "BARTON", "BARTONVILLE",
"BASSETT", "BATAVIA", "BATESBURG", "BATON ROUGE", "BAXTER SPRINGS",
"BAY CITY", "BAYONNE", "BAYSIDE", "BAYTOWN", "BEAR", "BEAUMONT",
"BEECH CREEK", "BEECHER CITY", "BELFAIR", "BELLE VERNON", "BELLEAIR",
"BELLEVUE", "BELLMAWR", "BELLMORE", "BELLWOOD", "BELMAR", "BELMONT",
"BELVIDERE", "BENNET", "BENTON", "BENTONVILLE", "BERLIN", "BESSEMER CITY",
"BETHANY", "BETHEL", "BETHEL PARK", "BETHESDA", "BETHLEHEM",
"BETTENDORF", "BIGLERVILLE", "BINGHAMTON", "BIRDSBORO", "BIWABIK",
"BLACK MOUNTAIN", "BLACKSBURG", "BLAINE", "BLAIRSVILLE", "BLAKESLEE",
"BLOOMFIELD", "BLUE BELL", "BLUE GRASS", "BLUE POINT", "BLUE SPRINGS",
"BOCA RATON", "BODFISH", "BOILING SPRINGS", "BOLIVAR", "BON AQUA",
"BONNER SPRINGS", "BONNEY LAKE", "BOONEVILLE", "BOSSIER CITY",
"BOUNTIFUL", "BOWLING GREEN", "BOYERTOWN", "BOYNTON BEACH", "BRADENTON",
"BRADENVILLE", "BRANDAMORE", "BRANDON", "BRANFORD", "BRANSON",
"BRASELTON", "BREEZEWOOD", "BRENTON", "BRENTWOOD", "BREWSTER",
"BRICK", "BRIDGEPORT", "BRIDGETON", "BRIGHAM CITY", "BROADDUS",
"BROCKPORT", "BROGUE", "BROKEN ARROW", "BRONX", "BROOKFIELD",
"BROOKHAVEN", "BROOKLYN", "BROWNS MILLS", "BROWNSBURG", "BROWNSVILLE",
"BRUNSWICK", "BRYAN", "BUCKSPORT", "BUDD LAKE", "BUFFALO", "BULVERDE",
"BUNKERVILLE", "BURBANK", "BURFORD", "BURIEN", "BURLINGTON",
"BURR RIDGE", "BURTON", "BUSKIRK", "BUTLER", "BUXTON", "BYRON",
"CALERA", "CAMBRIDGE", "CAMP HILL", "CAMPBELL", "CANAAN", "CANAL WINCHESTER",
"CANASTOTA", "CANTON", "CARDIFF BY THE SEA", "CARL JUNCTION",
"CARLISLE", "CARLTON", "CAROL STREAM", "CARROLLTON", "CARSON CITY",
"CARTERSVILLE", "CARTHAGE", "CARY", "CASEYVILLE", "CASSVILLE",
"CASWELL", "CATO", "CEDAR RAPIDS", "CEDARBURG", "CEDARVILLE",
"CENTER POINT", "CENTERTON", "CENTRAL ISLIP", "CENTRAL POINT",
"CHAGRIN FALLS", "CHALFONT", "CHAPEL HILL", "CHAPIN", "CHARDON",
"CHARITON", "CHARLESTON", "CHARLOTTE", "CHEROKEE", "CHERRY HILL",
"CHERRY VALLEY", "CHESHIRE", "CHEST SPRINGS", "CHESTER", "CHESTERTON",
"CHICAGO", "CHILLICOTHE", "CHOCTAW", "CICERO", "CINCINNATI",
"CLAY", "CLEARWATER", "CLEARWATER BEACH", "CLEMMONS", "CLENDENIN",
"CLEVELAND", "CLEVELAND HTS", "CLEVES", "CLIFFSIDE PARK", "CLIFTON",
"CLIFTON PARK", "CLIFTON SPGS", "CLINTON", "COACHELLA", "COAL TOWNSHIP",
"COATESVILLE", "COLLEGE STATION", "COLLINSVILLE", "COLONIA",
"COLUMBIA", "COLUMBUS", "COMMERCE", "CONCORD", "CONCORD TOWNSHIP",
"CONNELLSVILLE", "CONROE", "CONWAY", "CONYERS", "COOKEVILLE",
"COON RAPIDS", "CORAOPOLIS", "CORDOVA", "CORNELIUS", "CORNWALL",
"CORONADO", "CORPUS CHRISTI", "CORRY", "COTTAGE HILLS", "COTTLEVILLE",
"COTTONWOOD", "COVINGTON", "COWEN", "CRANBERRY TOWNSHIP", "CROWN POINT",
"CUBA", "CUMBERLAND CENTER", "CUMBERLAND FORESIDE", "CUMMING",
"CUYAHOGA FLS", "CYPRESS", "DALLAS", "DALLASTOWN", "DANBURY",
"DANIA BCH", "DANVILLE", "DAVENPORT", "DAVIE", "DAVIS JUNCTION",
"DAWSON", "DAYTON", "DE SOTO", "DECATUR", "DEFIANCE", "DEFOREST",
"DELAVAN", "DELMAR", "DELRAY BEACH", "DEMOTTE", "DENISON", "DENVER",
"DEPTFORD", "DERBY", "DERRY", "DES MOINES", "DETROIT", "DICKINSON",
"DILLSBURG", "DITTMER", "DIXON", "DONNA", "DOTHAN", "DOUGLAS",
"DOUGLASVILLE", "DOVER", "DOYLESTOWN", "DREXEL HILL", "DUBLIN",
"DUCHESNE", "DULUTH", "DUNCAN", "DUNCANNON", "DUNCANSVILLE",
"DUNEDIN", "DUNNSVILLE", "DURHAM", "DUTTON", "EAGLE GROVE", "EAST AURORA",
"EAST CHICAGO", "EAST EARL", "EAST HANOVER", "EAST HARTFORD",
"EAST HARTLAND", "EAST LEROY", "EAST LIVERPOOL", "EAST MEADOW",
"EAST NORTHPORT", "EAST ORANGE", "EAST PEORIA", "EAST SAINT LOUIS",
"EASTON", "EDGERTON", "EDISON", "EDMOND", "EGG HBR TWP", "EL DORADO",
"EL PASO", "ELDRIDGE", "ELGIN", "ELIZABETHVILLE", "ELLISVILLE",
"ELLSWORTH", "ELLWOOD CITY", "ELMHURST", "ELMWOOD PARK", "ELOY",
"ELY", "EMERSON", "EMORY", "ENDICOTT", "ENGLEWOOD", "ENID", "ENNICE",
"ENOLA", "ENUMCLAW", "EPHRATA", "ERIE", "ESTERO", "EUREKA SPRINGS",
"EVANSVILLE", "EVERETT", "EXCELSIOR SPRINGS", "EXTON", "FAIRFAX",
"FAIRFIELD", "FAIRHAVEN", "FAIRVIEW", "FAIRVIEW PARK", "FALMOUTH",
"FAR HILLS", "FAR ROCKAWAY", "FARMINGDALE", "FARMINGTON", "FAYETTE",
"FAYETTEVILLE", "FELTON", "FENTON", "FERGUSON", "FIELDALE", "FINDLAY",
"FINGERVILLE", "FLEMINGTON", "FLINT", "FLORENCE", "FLORESVILLE",
"FLORISSANT", "FLOVILLA", "FLOWER MOUND", "FLUSHING", "FOGELSVILLE",
"FOLSOM", "FONTANELLE", "FOREST HILLS", "FOREST PARK", "FORT DODGE",
"FORT FAIRFIELD", "FORT GAY", "FORT LAUDERDALE", "FORT LEE",
"FORT MILL", "FORT MOHAVE", "FORT PAYNE", "FORT PIERCE", "FORT SMITH",
"FORT WAYNE", "FORT WORTH", "FOSTORIA", "FOUNTAIN INN", "FRANKFORT",
"FRANKLIN", "FREEDOM", "FREEHOLD", "FREEPORT", "FREMONT", "FULLERTON",
"FULSHEAR", "FULTON", "GADSDEN", "GAFFNEY", "GAINESVILLE", "GALLOWAY",
"GARDEN PRAIRIE", "GARDNERS", "GARNETT VALLEY", "GARY", "GASTON",
"GASTONIA", "GENEVA", "GETTYSBURG", "GIBSONIA", "GILBERT", "GIRARD",
"GLEN BURNIE", "GLEN CARBON", "GLEN COVE", "GLEN MILLS", "GLENSHAW",
"GLENVIEW", "GLENWOOD", "GOLDEN CITY", "GOLIAD", "GOODSON", "GOODYEAR",
"GORHAM", "GOSHEN", "GRANBURY", "GRANBY", "GRAND PRAIRIE", "GRAND RAPIDS",
"GRANDVIEW", "GRANITE CITY", "GRANITE FALLS", "GRANTS PASS",
"GRASS VALLEY", "GRAVETTE", "GRAYSVILLE", "GREEN LANE", "GREENBRIER",
"GREENLAWN", "GREENSBORO", "GREENSBURG", "GREENUP", "GREENVILLE",
"GREER", "GRIFFIN", "GRIFFITH", "GROTON", "GUADALUPE", "GUILFORD",
"HADLEY", "HAGAN", "HALF WAY", "HALLANDALE BEACH", "HAMBLETON",
"HAMBURG", "HAMDEN", "HAMILTON", "HAMMOND", "HAMMONTON", "HAMPSHIRE",
"HAPEVILLE", "HARBORCREEK", "HARLAN", "HARRISBURG", "HARRISON",
"HARRISONVILLE", "HARTWELL", "HASTINGS", "HATFIELD", "HAVERHILL",
"HAWK POINT", "HAYESVILLE", "HELEN", "HENDERSON", "HENDERSONVILLE",
"HENRICO", "HENRIETTA", "HERMITAGE", "HERNDON", "HERSHEY", "HIALEAH",
"HIAWATHA", "HIBBING", "HICKORY", "HICKORY GROVE", "HIDDENITE",
"HIGH HILL", "HIGH POINT", "HIGH RIDGE", "HIGHLAND", "HIGHLAND MILLS",
"HINCKLEY", "HIRAM", "HOBART", "HOLBROOK", "HOLDEN", "HOLDENVILLE",
"HOLLADAY", "HOLLIS", "HOLLY SPRINGS", "HOLLYWOOD", "HOLTWOOD",
"HOMER", "HOMESTEAD", "HONEYVILLE", "HOPE MILLS", "HOT SPRINGS",
"HOT SPRINGS NATIONAL PARK", "HOUSTON", "HUBBARD", "HUDSON",
"HUFFMAN", "HULL", "HUMANSVILLE", "HUNTERSVILLE", "HUNTINGDON",
"HUNTINGTON BEACH", "HUNTS POINT", "HURDLE MILLS", "HURRICANE",
"HURST", "IMPERIAL", "INDEPENDENCE", "INDIAN SHORES", "INDIAN TRAIL",
"INDIANA", "INDIANAPOLIS", "INDIANOLA", "INMAN", "IOWA CITY",
"IRMO", "IRVINGTON", "IRWIN", "ISANTI", "ISLESBORO", "ISLIP",
"ISSAQUAH", "ITHACA", "JACKSBORO", "JACKSON", "JACKSON HTS",
"JACKSONVILLE", "JAMAICA", "JAMESTOWN", "JASPER", "JEANNETTE",
"JEFFERSON", "JEFFERSON CITY", "JEWELL", "JOHNSTON", "JOHNSTOWN",
"JONESBORO", "JONESPORT", "JONESTOWN", "JOPLIN", "JUPITER", "KANKAKEE",
"KANNAPOLIS", "KANSAS CITY", "KATY", "KEARNEY", "KELLERTON",
"KEMAH", "KENMORE", "KENNESAW", "KENT", "KINGMAN", "KINGS MOUNTAIN",
"KINGSLAND", "KINGSTON", "KINGWOOD", "KIRKLAND", "KUTZTOWN",
"LA QUINTA", "LA RUE", "LA VERNE", "LAFAYETTE", "LAKE BLUFF",
"LAKE IN THE HILL", "LAKE ISABELLA", "LAKE PLACID", "LAKE SAINT LOUIS",
"LAKE TAPPS", "LAKE VILLAGE", "LAKE WAUKOMIS", "LAKE WORTH",
"LAKEBAY", "LAKELAND", "LAKEWOOD", "LAKEWOOD RCH", "LAMBERTVILLE",
"LANCASTER", "LANDISVILLE", "LANSDALE", "LAREDO", "LARGO", "LAS VEGAS",
"LATROBE", "LAUDERHILL", "LAWNDALE", "LAWRENCE", "LAWRENCEVILLE",
"LE MARS", "LE ROY", "LEAGUE CITY", "LEAVENWORTH", "LEAWOOD",
"LEBANON", "LECOMPTON", "LEECHBURG", "LEES SUMMIT", "LEESBURG",
"LEESVILLE", "LEETONIA", "LENEXA", "LENOIR", "LEVITTOWN", "LEWES",
"LEWISTOWN", "LEXINGTON", "LIBERTY TWP", "LILLINGTON", "LINCOLN",
"LINDENHURST", "LINTON", "LISBON", "LITCHFIELD PK", "LITHIA",
"LITITZ", "LITTLE EGG HARBOR TO", "LK FOREST PK", "LK PEEKSKILL",
"LOCKHART", "LOCKWOOD", "LOGAN", "LOMA LINDA", "LONE JACK", "LONG BEACH",
"LONG LANE", "LONGVIEW", "LORAIN", "LORTON", "LOS ANGELES", "LOUISBURG",
"LOVES PARK", "LOWER BURRELL", "LOWRY CITY", "LUBBOCK", "LUGOFF",
"LUMBERTON", "LYNBROOK", "LYNNWOOD", "MACHESNEY PARK", "MACON",
"MAGNOLIA", "MAHOPAC", "MAHWAH", "MAINEVILLE", "MALVERN", "MALVERNE",
"MANASSAS", "MANCHACA", "MANCHESTER", "MANCHESTER TOWNSHIP",
"MANCHESTER TW", "MANHEIM", "MANITO", "MANLIUS", "MANNINGTON",
"MANSFIELD", "MANSURA", "MAPLE PARK", "MARBLE FALLS", "MARCELLUS",
"MARICOPA", "MARIETTA", "MARION", "MARKLEYSBURG", "MARS HILL",
"MARSHALLTOWN", "MARSHFIELD", "MARSHVILLE", "MARTINSVILLE", "MARYSVILLE",
"MASON CITY", "MASSEY", "MASSILLON", "MASURY", "MATAWAN", "MATEWAN",
"MATTAPOISETT", "MATTHEWS", "MAYFIELD HTS", "MAYSEL", "MC CLELLAND",
"MC DONALD", "MC KEES ROCKS", "MC SHERRYSTOWN", "MC VEYTOWN",
"MCALESTER", "MCDONOUGH", "MCKEESPORT", "MCKINNEY", "MECHANICSBURG",
"MECHANICSVILLE", "MEDFORD", "MEDIA", "MEDWAY", "MELVILLE", "MEMPHIS",
"MERIDEN", "MERRIAM", "MERRICK", "MERRILL", "MERRILLVILLE", "MESA",
"MESQUITE", "MIAMI", "MIAMI GARDENS", "MICHIGAN CITY", "MIDDLETOWN",
"MIDLAND", "MIFFLINTOWN", "MILFORD", "MILL CREEK", "MILLBROOK",
"MILLEDGEVILLE", "MILLINOCKET", "MILNER", "MILTON", "MILWAUKEE",
"MINEOLA", "MINERAL SPGS", "MINERAL WELLS", "MINNEAPOLIS", "MISSION",
"MISSION HILLS", "MISSION VIEJO", "MISSOURI CITY", "MISSOURI VALLEY",
"MOLINE", "MONESSEN", "MONROE", "MONROE TOWNSHIP", "MONROEVILLE",
"MONTCLAIR", "MONTEREY", "MONTICELLO", "MOORESVILLE", "MORGANTON",
"MORGANTOWN", "MORRIS PLAINS", "MOUND", "MOUND CITY", "MOUNT HOPE",
"MOUNT JOY", "MOUNT LAUREL", "MOUNT PLEASANT", "MOUNT POCONO",
"MOUNT UNION", "MOUNT WOLF", "MOUNTVILLE", "MT HOLLY", "MT PLEASANT",
"MULVANE", "MUNCIE", "MUNSTER", "MURFREESBORO", "MURRAY", "MURRELLS INLT",
"MUSTANG", "MYERSTOWN", "MYSTIC", "N BRANFORD", "N FT MYERS",
"NAPERVILLE", "NAPLES", "NAPOLEON", "NASHVILLE", "NATCHITOCHES",
"NAUGATUCK", "NEOSHO", "NEPTUNE BEACH", "NESCONSET", "NETCONG",
"NEW BLOOMFIELD", "NEW BRAUNFELS", "NEW BRITAIN", "NEW BRUNSWICK",
"NEW CASTLE", "NEW CUMBERLAND", "NEW HAVEN", "NEW KENSINGTON",
"NEW LONDON", "NEW ORLEANS", "NEW PRESTON", "NEW PROVIDENCE",
"NEW ROCHELLE", "NEW TRIPOLI", "NEW ULM", "NEW WINDSOR", "NEW YORK",
"NEWARK", "NEWBURGH HEIGHTS", "NEWINGTON", "NEWNAN", "NEWPORT",
"NEWPORT BEACH", "NEWTON", "NEWTONVILLE", "NIAGARA FALLS", "NIXA",
"NOANK", "NOKOMIS", "NORCROSS", "NORFOLK", "NORMAN", "NORMANDY PARK",
"NORTH BABYLON", "NORTH HAVEN", "NORTH HUNTINGDON", "NORTH JACKSON",
"NORTH LITTLE ROCK", "NORTH MIAMI", "NORTH PORT", "NORTH RICHLAND HILLS",
"NORTH WALES", "NORTH WATERBORO", "NORTHFIELD", "NORTHRIDGE",
"NORTON", "NORWALK", "NOTTINGHAM", "NUTLEY", "NYACK", "O FALLON",
"OAK RIDGE", "OAKDALE", "OCALA", "OCEANSIDE", "OCILLA", "OLATHE",
"OMAHA", "OMRO", "ONA", "ONALASKA", "OPA LOCKA", "ORADLL", "ORION",
"ORONO", "ORRINGTON", "OSCEOLA", "OSKALOOSA", "OSSINING", "OSWEGO",
"OTTAWA", "OVALO", "OVERLAND PARK", "OWASSO", "OWEGO", "OXFORD",
"OYSTER BAY", "OZARK", "PALERMO", "PALM CITY", "PALM HARBOR",
"PALMDALE", "PALMYRA", "PALOS HEIGHTS", "PANA", "PAOLA", "PARK RIDGE",
"PARLIN", "PARMA", "PARRISH", "PARROTT", "PATASKALA", "PAULS VALLEY",
"PAXTON", "PEA RIDGE", "PEARLAND", "PECULIAR", "PEEKSKILL", "PEKIN",
"PELION", "PEMBROKE", "PEMBROKE PINES", "PENN YAN", "PENNELLVILLE",
"PENNSBURG", "PENNSVILLE", "PEORIA", "PERRY", "PERRYOPOLIS",
"PERRYSBURG", "PERRYVILLE", "PHARR", "PHILADELPHIA", "PHILIPPI",
"PHOENIX", "PICKENS", "PICKERINGTON", "PIERSON", "PILOT MOUNTAIN",
"PINE BLUFF", "PINE HILL", "PINEVILLE", "PINNELLAS PARK", "PISCATAWAY",
"PITMAN", "PITTSBURGH", "PLACIDA", "PLAINFIELD", "PLANO", "PLANT CITY",
"PLATTEKILL", "PLEASANT HILL", "PLEASANT HOPE", "PLYMOUTH", "POCONO LAKE",
"POMFRET CENTER", "POMPANO BEACH", "POOLER", "PORT CARBON", "PORT CHARLOTTE",
"PORT NORRIS", "PORT ORANGE", "PORT SAINT LUCIE", "PORT WASHINGTON",
"PORTAGE", "PORTER", "PORTERSVILLE", "PORTLAND", "POTTSVILLE",
"POUGHKEEPSIE", "POWDER SPRINGS", "POWELL", "PRAIRIE VILLAGE",
"PRESCOTT", "PRESCOTT VALLEY", "PRINCETON", "PROSPECT", "PT PLEASANT",
"PUNTA GORDA", "PURCHASE", "QUAKERTOWN", "QUEENS VLG", "QUINCY",
"RALEIGH", "RANDLEMAN", "RANDOLPH", "RAYTOWN", "READING", "READLYN",
"RED BANK", "RED HOUSE", "RED LION", "REEDERS", "REGO PARK",
"REHOBOTH BCH", "REIDSVILLE", "RENO", "RENTON", "REPUBLIC", "RICH HILL",
"RICHARDS", "RICHMOND", "RICHMOND HILL", "RIDGEWOOD", "RINCON",
"RIO GRANDE CITY", "RIO RANCHO", "RIVERDALE", "RIVERHEAD", "RIVERSIDE",
"ROANOKE", "ROCHELLE", "ROCHESTER", "ROCK HILL", "ROCKAWAY BCH",
"ROCKFORD", "ROCKMART", "ROCKY HILL", "ROCKY MOUNT", "ROGERS",
"ROGERSVILLE", "ROMULUS", "ROOSEVELT", "ROSAMOND", "ROSCOE",
"ROSENBERG", "ROSENDALE", "ROSWELL", "ROTONDA WEST", "ROUGEMONT",
"ROXBORO", "ROY", "RUNNELLS", "RURAL HALL", "RUSH VALLEY", "RUSKIN",
"RUSTBURG", "RUTHER GLEN", "RUTHERFORDTON", "S DEERFIELD", "SACO",
"SAGINAW", "SAINT AUGUSTINE", "SAINT CHARLES", "SAINT CLAIR",
"SAINT CLAIRSVILLE", "SAINT LOUIS", "SAINT MARYS", "SAINT MATTHEWS",
"SAINT PAULS", "SAINT PETERS", "SAINT PETERSBURG", "SALEM", "SALISBURY",
"SALT LAKE CITY", "SALTSBURG", "SALUNGA", "SAMMAMISH", "SAN ANTONIO",
"SAN BENITO", "SAN CLEMENTE", "SAN DIEGO", "SAN ELIZARIO", "SAN JUAN",
"SANDUSKY", "SANDY", "SANFORD", "SANGERVILLE", "SANTA ANA", "SARASOTA",
"SARATOGA SPRINGS", "SARCOXIE", "SAUGUS", "SAVANNAH", "SAYVILLE",
"SCALY MOUNTAIN", "SCHAEFFERSTOWN", "SCHULENBURG", "SCOTT", "SCOTTSDALE",
"SEAFORD", "SEALE", "SEATTLE", "SEDONA", "SEGUIN", "SELDEN",
"SENECA", "SENOIA", "SEVEN VALLEYS", "SEYMOUR", "SHARON", "SHARPSBURG",
"SHARPSVILLE", "SHAVANO PARK", "SHAWNEE", "SHELLSBURG", "SHELTON",
"SHENANDOAH", "SHORELINE", "SHOREWOOD", "SHREVEPORT", "SICKLERVILLE",
"SILER CITY", "SILOAM SPRINGS", "SIMON", "SIMPSONVILLE", "SIMSBURY",
"SIOUX CITY", "SIOUX FALLS", "SKOKIE", "SKOWHEGAN", "SLATINGTON",
"SLIDELL", "SMITHFIELD", "SN BERNRDNO", "SNELLVILLE", "SOCORRO",
"SOMERS", "SOPHIA", "SOUTH AMBOY", "SOUTH BELOIT", "SOUTH BEND",
"SOUTH DARTMOUTH", "SOUTH HOUSTON", "SOUTH PARK", "SOUTH PLAINFIELD",
"SOUTH SIOUX CITY", "SOUTHAMPTON", "SOUTHBURY", "SOUTHGATE",
"SPARKS", "SPARROW BUSH", "SPENCER", "SPRING", "SPRING BRANCH",
"SPRING GROVE", "SPRING HILL", "SPRING HOPE", "SPRING VALLEY",
"SPRINGDALE", "SPRINGFIELD", "SPRINGFIELD GARDENS", "SPRINGHILL",
"SPRINGTOWN", "SPRNGFLD GDNS", "SPRUCE PINE", "ST PETERSBURG",
"ST. GEORGE", "STAFFORD", "STAMFORD", "STANDISH", "STANLEY",
"STANTON", "STATEN ISLAND", "STATESVILLE", "STERLING", "STILLMAN VALLEY",
"STILWELL", "STOCKBRIDGE", "STOCKTON", "STONE MTN", "STRAFFORD",
"STRATFORD", "STRONGSVILLE", "STROUDSBURG", "STRUTHERS", "SUFFIELD",
"SUGAR HILL", "SUGAR LAND", "SULPHUR", "SUMMERVILLE", "SUMMIT",
"SUN CITY", "SUNBURY", "SUWANEE", "SWANSEA", "SWANTON", "SWEENY",
"SWISSVALE", "SYCAMORE", "SYLVANIA", "SYRACUSE", "TACOMA", "TAFTVILLE",
"TAMPA", "TAPPAHANNOCK", "TAR HEEL", "TAUNTON", "TAYLORVILLE",
"TECUMSEH", "THE WOODLANDS", "THEODOSIA", "THOMASTON", "THOMASVILLE",
"TIERRA VERDE", "TIFTON", "TILLSON", "TILTON", "TINLEY PARK",
"TOCCOA", "TOLEDO", "TOLLAND", "TOMBALL", "TOMS RIVER", "TOPEKA",
"TOPSHAM", "TORRINGTON", "TOVEY", "TOWNSEND", "TRAVELERS RST",
"TRENT", "TRINITY", "TROUTMAN", "TROY", "TRUMBULL", "TUCKER",
"TULALIP", "TURNER", "TUSCUMBIA", "TYRONE", "UNION", "UNION CITY",
"UNIVERSAL CTY", "UNIVERSITY HTS", "UPPR CHICHSTR", "URBANA",
"URBANDALE", "UTICA", "VAIL", "VALE", "VALENCIA", "VALPARAISO",
"VAN BUREN", "VAN METER", "VAN WERT", "VANDERGRIFT", "VASSALBORO",
"VAUGHN", "VENICE", "VERNAL", "VERNON", "VERONA", "VICTOR", "VIDALIA",
"VIENNA", "VILLA GROVE", "VILLA RIDGE", "VOLANT", "W HAMPTON BCH",
"W TERRE HAUTE", "WADSWORTH", "WAHOO", "WAKE FOREST", "WALDEN",
"WALLINGFORD", "WALLINGTON", "WALNUT COVE", "WANAQUE", "WARFORDSBURG",
"WARMINSTER", "WARREN", "WARSAW", "WARTHEN", "WASHINGTON", "WASOLA",
"WATAUGA", "WATERBURY", "WATERFORD", "WATERLOO", "WATERVILLE",
"WATKINS GLEN", "WAXAHACHIE", "WAYCROSS", "WAYNESBORO", "WEBSTER",
"WEIRTON", "WELLSBORO", "WELLSVILLE", "WENTZVILLE", "WESLACO",
"WEST CHESTER", "WEST DEPTFORD", "WEST DES MOINES", "WEST HAVEN",
"WEST HICKORY", "WEST LIBERTY", "WEST MIFFLIN", "WEST PALM BEACH",
"WEST POINT", "WEST READING", "WEST SENECA", "WEST SUFFIELD",
"WEST VALLEY CITY", "WESTERVILLE", "WESTHAMPTON", "WESTMINSTER",
"WESTMORELAND CITY", "WESTPORT", "WESTVILLE", "WETHERSFIELD",
"WHARTON", "WHEELING", "WHITE PLAINS", "WHITEHALL", "WHITESTONE",
"WHITESTOWN", "WHITING", "WHITMAN", "WHITTIER", "WICHITA", "WILDWOOD",
"WILLARD", "WILLIAMSBURG", "WILLIAMSPORT", "WILLOW GROVE", "WILLOWBROOK",
"WILLOWICK", "WILMETTE", "WILMINGTON", "WILSON", "WILTON MANORS",
"WIMBERLEY", "WINDCREST", "WINDER", "WINNEBAGO", "WINSIDE", "WINSTON",
"WINSTON SALEM", "WINTERSET", "WINTHROP", "WOLCOTT", "WOODBRIDGE",
"WOODBURY HEIGHTS", "WOODLAND PARK", "WOODLAWN", "WOODS CROSS",
"WOODSIDE", "WOODSTOCK", "WORTHINGTON", "WYOMISSING", "YARMOUTH",
"YOE", "YONKERS", "YORK", "YORKTOWN", "YORKTOWN HEIGHTS", "YOUNG HARRIS",
"YOUNGSTOWN", "YPSILANTI", "ZELIENOPLE", "ZEPHYRHILLS"), class = "factor"),
    Longitude = c(-73.995761, -73.919757, -73.901704, -73.99728,
    -73.966576, -73.90666, -74.00156, -74.139018, -73.964397,
    -74.217701, -73.97337, -74.085848, -74.016758, -73.973516,
    -74.126856, -73.934765, -73.953425, -74.002203, -74.088222,
    -73.9429, -73.958444, -74.00212, -74.00271, -73.976911, -73.998995,
    -73.962247, -73.872685, -74.200874, -73.966365, -73.970639,
    -73.955408, -74.161088, -73.900613, -73.973114, -74.090524,
    -74.153605, -74.128318, -73.921273, -73.906545, -74.182027,
    -74.169198, -74.131182, -74.105751, -74.21093, -74.15824,
    -74.100691, -73.94765, -74.096255, -74.0071, -73.948231,
    -73.928844, -73.985222, -73.908936, -74.106965, -73.994567,
    -73.894023, -73.914155, -74.130657, -74.128292, -74.064724,
    -73.943069, -73.923314, -73.9731), Latitude = c(40.809175,
    40.701661, 40.751745, 40.67782, 40.590695, 40.64745, 40.75194,
    40.629037, 40.689129, 40.545124, 40.578366, 40.635833, 40.623769,
    40.57672, 40.629612, 40.623998, 40.581446, 40.639925, 40.603879,
    40.63933, 40.656341, 40.727757, 40.73855, 40.579848, 40.61122,
    40.593927, 40.745527, 40.528453, 40.807577, 40.589197, 40.577279,
    40.590244, 40.709039, 40.673746, 40.571051, 40.588417, 40.574502,
    40.68636, 40.739854, 40.564292, 40.554251, 40.557496, 40.677064,
    40.548405, 40.583232, 40.588659, 40.77633, 40.639926, 40.67494,
    40.599486, 40.686703, 40.633875, 40.613306, 40.560111, 40.606369,
    40.749488, 40.607459, 40.615182, 40.623143, 40.594011, 40.593785,
    40.668828, 40.58116)), class = "data.frame", row.names = c(NA,
-63L)), coords.nrs = 5:6, coords = structure(c(-73.995761, -73.919757,
-73.901704, -73.99728, -73.966576, -73.90666, -74.00156, -74.139018,
-73.964397, -74.217701, -73.97337, -74.085848, -74.016758, -73.973516,
-74.126856, -73.934765, -73.953425, -74.002203, -74.088222, -73.9429,
-73.958444, -74.00212, -74.00271, -73.976911, -73.998995, -73.962247,
-73.872685, -74.200874, -73.966365, -73.970639, -73.955408, -74.161088,
-73.900613, -73.973114, -74.090524, -74.153605, -74.128318, -73.921273,
-73.906545, -74.182027, -74.169198, -74.131182, -74.105751, -74.21093,
-74.15824, -74.100691, -73.94765, -74.096255, -74.0071, -73.948231,
-73.928844, -73.985222, -73.908936, -74.106965, -73.994567, -73.894023,
-73.914155, -74.130657, -74.128292, -74.064724, -73.943069, -73.923314,
-73.9731, 40.809175, 40.701661, 40.751745, 40.67782, 40.590695,
40.64745, 40.75194, 40.629037, 40.689129, 40.545124, 40.578366,
40.635833, 40.623769, 40.57672, 40.629612, 40.623998, 40.581446,
40.639925, 40.603879, 40.63933, 40.656341, 40.727757, 40.73855,
40.579848, 40.61122, 40.593927, 40.745527, 40.528453, 40.807577,
40.589197, 40.577279, 40.590244, 40.709039, 40.673746, 40.571051,
40.588417, 40.574502, 40.68636, 40.739854, 40.564292, 40.554251,
40.557496, 40.677064, 40.548405, 40.583232, 40.588659, 40.77633,
40.639926, 40.67494, 40.599486, 40.686703, 40.633875, 40.613306,
40.560111, 40.606369, 40.749488, 40.607459, 40.615182, 40.623143,
40.594011, 40.593785, 40.668828, 40.58116), .Dim = c(63L, 2L), .Dimnames = list(
    c("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", "37", "38", "39", "40", "41",
    "42", "43", "44", "45", "46", "47", "48", "49", "50", "51",
    "52", "53", "54", "55", "56", "57", "58", "59", "60", "61",
    "62", "63"), c("lon", "lat"))), bbox = structure(c(-74.217701,
40.528453, -73.872685, 40.809175), .Dim = c(2L, 2L), .Dimnames = list(
    c("lon", "lat"), c("min", "max"))), proj4string = new("CRS",
    projargs = "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"))

Thank you for any assistance.
WHP


Proprietary

NOTICE TO RECIPIENT OF INFORMATION:\ This e-mail may con...{{dropped:16}}

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply | Threaded
Open this post in threaded view
|

Re: Help with geocode() & get_map() please

R-sig-geo mailing list
Ok, thank you, I suspected that and was unsure how to proceed beyond what I had described originally.

I will review your reference.

Thank you for your response Kent, much appreciated.

WHP

From: Kent Johnson <[hidden email]>
Sent: Thursday, May 28, 2020 7:52 AM
To: [hidden email]; Poling, William <[hidden email]>
Subject: [EXTERNAL] Re: Help with geocode() & get_map() please

**** External Email - Use Caution ****
On Thu, May 28, 2020 at 6:03 AM <mailto:[hidden email]> wrote:
Message: 1
Date: Wed, 27 May 2020 19:55:26 +0000
From: "Poling, William" <mailto:[hidden email]>
Subject: [R-sig-Geo] Help with geocode()  & get_map() please
 
2. I am having trouble with get_map()

ny.map <- get_map("New York", zoom = 8)

Source : https://urldefense.proofpoint.com/v2/url?u=https-3A__maps.googleapis.com_maps_api_staticmap-3Fcenter-3DNew-2520York-26zoom-3D8-26size-3D640x640-26scale-3D2-26maptype-3Dterrain-26language-3Den-2DEN-26key-3D-5B012819-2D836529-2D634EA5-5D&d=DwMFaQ&c=wluqKIiwffOpZ6k5sqMWMBOn0vyYnlulRJmmvOXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2ExlYvnUWbsByY&m=CsMl9LHpa9ULoNXKdkrUT6ekC9fM5srAwGtqAbNgep0&s=l5KYIQUC-rz6VESNkigtwbi7rx-YYayVqIrdsrN0prE&e=
Error in aperm.default(map, c(2, 1, 3)) :
invalid first argument, must be an array
In addition: Warning message:
In get_googlemap(center = location, zoom = zoom, maptype = maptype,  :
  HTTP 400 Bad Request

This looks like the problem described here:
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_dkahle_ggmap_issues_262&d=DwMFaQ&c=wluqKIiwffOpZ6k5sqMWMBOn0vyYnlulRJmmvOXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2ExlYvnUWbsByY&m=CsMl9LHpa9ULoNXKdkrUT6ekC9fM5srAwGtqAbNgep0&s=TegKIx-xo3fzI61Ul_ejBvccaNAV2c0cHSrQV5-5rNg&e=

It is a problem with your Google credentials. 

Kent 

Proprietary

NOTICE TO RECIPIENT OF INFORMATION:
This e-mail may contain confidential or privileged information. If you think you have received this e-mail in error, please advise the sender by reply e-mail and then delete this e-mail immediately.  
This e-mail may also contain protected health information (PHI) with information about sensitive medical conditions, including, but not limited to, treatment for substance use disorders, behavioral health, HIV/AIDS, or pregnancy. This type of information may be protected by various federal and/or state laws which prohibit any further disclosure without the express written consent of the person to whom it pertains or as otherwise permitted by law. Any unauthorized further disclosure may be considered a violation of federal and/or state law. A general authorization for the release of medical or other information may NOT be sufficient consent for release of this type of information.
Thank you. Aetna
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Help with geocode() & get_map() please

R-sig-geo mailing list
In reply to this post by R-sig-geo mailing list
Hello again.

With Google help chat I discovered that I (we all) have a cloud billing Key and an API key.

I had everything correct in the cloud dashboard in terms of enabled API's, however, I was repeatedly trying to register the billing key and getting the errors after running the scripts, UGH!

register_google(key = "000000-000000-000AA0", write = TRUE) Billing Key NO GOOD
register_google(key = "Blahblah0BBLLAAHHblahlllaaabb00blah", write = TRUE) API Key from credentials GOOD

I hope this helps someone else down stream

Thank you Kent!

WHP

From: Kent Johnson <[hidden email]>
Sent: Thursday, May 28, 2020 7:52 AM
To: [hidden email]; Poling, William <[hidden email]>
Subject: [EXTERNAL] Re: Help with geocode() & get_map() please

**** External Email - Use Caution ****
On Thu, May 28, 2020 at 6:03 AM <mailto:[hidden email]> wrote:
Message: 1
Date: Wed, 27 May 2020 19:55:26 +0000
From: "Poling, William" <mailto:[hidden email]>
Subject: [R-sig-Geo] Help with geocode()  & get_map() please
 
2. I am having trouble with get_map()

ny.map <- get_map("New York", zoom = 8)

Source : https://urldefense.proofpoint.com/v2/url?u=https-3A__maps.googleapis.com_maps_api_staticmap-3Fcenter-3DNew-2520York-26zoom-3D8-26size-3D640x640-26scale-3D2-26maptype-3Dterrain-26language-3Den-2DEN-26key-3D-5B012819-2D836529-2D634EA5-5D&d=DwMFaQ&c=wluqKIiwffOpZ6k5sqMWMBOn0vyYnlulRJmmvOXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2ExlYvnUWbsByY&m=CsMl9LHpa9ULoNXKdkrUT6ekC9fM5srAwGtqAbNgep0&s=l5KYIQUC-rz6VESNkigtwbi7rx-YYayVqIrdsrN0prE&e=
Error in aperm.default(map, c(2, 1, 3)) :
invalid first argument, must be an array
In addition: Warning message:
In get_googlemap(center = location, zoom = zoom, maptype = maptype,  :
  HTTP 400 Bad Request

This looks like the problem described here:
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_dkahle_ggmap_issues_262&d=DwMFaQ&c=wluqKIiwffOpZ6k5sqMWMBOn0vyYnlulRJmmvOXCFpM&r=j7MrcIQm2xjHa8v-2mTpmTCtKvneM2ExlYvnUWbsByY&m=CsMl9LHpa9ULoNXKdkrUT6ekC9fM5srAwGtqAbNgep0&s=TegKIx-xo3fzI61Ul_ejBvccaNAV2c0cHSrQV5-5rNg&e=

It is a problem with your Google credentials. 

Kent 

Proprietary

NOTICE TO RECIPIENT OF INFORMATION:
This e-mail may contain confidential or privileged information. If you think you have received this e-mail in error, please advise the sender by reply e-mail and then delete this e-mail immediately.  
This e-mail may also contain protected health information (PHI) with information about sensitive medical conditions, including, but not limited to, treatment for substance use disorders, behavioral health, HIV/AIDS, or pregnancy. This type of information may be protected by various federal and/or state laws which prohibit any further disclosure without the express written consent of the person to whom it pertains or as otherwise permitted by law. Any unauthorized further disclosure may be considered a violation of federal and/or state law. A general authorization for the release of medical or other information may NOT be sufficient consent for release of this type of information.
Thank you. Aetna
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo