Add map to Listings tab showing active listing locations
Some checks failed
Deploy stAndrews / deploy (push) Failing after 2s
Some checks failed
Deploy stAndrews / deploy (push) Failing after 2s
This commit is contained in:
31
app.R
31
app.R
@@ -255,6 +255,11 @@ ui <- f7Page(
|
|||||||
title = "Listings",
|
title = "Listings",
|
||||||
tabName = "Listings",
|
tabName = "Listings",
|
||||||
icon = f7Icon("tag_fill"),
|
icon = f7Icon("tag_fill"),
|
||||||
|
f7Card(
|
||||||
|
title = "Map:",
|
||||||
|
divider = TRUE,
|
||||||
|
leafletOutput("listings_map")
|
||||||
|
),
|
||||||
f7Card(
|
f7Card(
|
||||||
title = "Active Listings:",
|
title = "Active Listings:",
|
||||||
divider = TRUE,
|
divider = TRUE,
|
||||||
@@ -473,6 +478,32 @@ server <- function(input, output) {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# listings map ----
|
||||||
|
output$listings_map <- renderLeaflet({
|
||||||
|
leaflet() |>
|
||||||
|
addProviderTiles("CartoDB.Voyager") |>
|
||||||
|
addPolygons(
|
||||||
|
data = sbdvn,
|
||||||
|
color = "red",
|
||||||
|
weight = 2,
|
||||||
|
opacity = 0.5,
|
||||||
|
fillOpacity = 0.2,
|
||||||
|
label = ~sub_name
|
||||||
|
) |>
|
||||||
|
addMarkers(
|
||||||
|
data = listings,
|
||||||
|
lat = ~latitude,
|
||||||
|
lng = ~longitude,
|
||||||
|
popup = ~paste0(
|
||||||
|
"<b>", address, "</b><br>",
|
||||||
|
"Price: ", scales::dollar(price), "<br>",
|
||||||
|
"Sq Ft: ", sqft, "<br>",
|
||||||
|
"$/Sq Ft: ", scales::dollar(price_per_sqft)
|
||||||
|
)
|
||||||
|
) |>
|
||||||
|
setView(lng = -82.362253, lat = 27.076199, zoom = 16)
|
||||||
|
})
|
||||||
|
|
||||||
# listings table ----
|
# listings table ----
|
||||||
output$listings_table <- renderDT({
|
output$listings_table <- renderDT({
|
||||||
datatable(
|
datatable(
|
||||||
|
|||||||
Reference in New Issue
Block a user