Add map to Listings tab showing active listing locations
Some checks failed
Deploy stAndrews / deploy (push) Failing after 2s

This commit is contained in:
2026-03-09 16:22:01 -04:00
parent 48559e7906
commit f029462e5f

31
app.R
View File

@@ -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(