| geocode | R Documentation |
Get Lat/Lon Cooridinates for an Address.
geocode(address.string)
address.string |
character vector of addresses to geocode. |
This function uses the findAddressCandidates utility at
Arcgis.com
to get coordinates for a single address.
A data frame with probable address locations.
ol_geom_point,
ol_geom_icon,
address <- "1600 Pennsylvania Ave NW, Washington, DC 20500"
## Not run:
g <- geocode(address)
point.matrix <- matrix(
c(
as.numeric(g$location[1,1]),
as.numeric(g$location[1,2])
),
nrow=1
)
point.df <- data.frame(
pt.type="White House"
)
mymap <- ol_map(
center=c(-77.03196,38.89037),
zoom=12
) +
streetmap() +
ol_geom_point(
point.matrix,
name="Points of Interest",
marker="pin",
toggle.control=TRUE,
tooltip=point.df$pt.type
)
# Output to file and view
ol_map2HTML(mymap,'map.html')
browseURL('map.html')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.