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
| server <- function(input, output, session) {
a<- eventReactive(input$dim, {
SQL <- paste("SELECT instance_id,first_name,last_name,gender,postcode,latitude,longitude,moving_date,city,'D' as Demenagement from core.users inner join core.address on core.users.destination_address_id=core.address.id
where core.address.latitude>48 and core.address.latitude<51 and core.address.longitude>-5.5667 and core.address.longitude<0.5316 where instance='",input$dim,"';",sep="")
df_postgresUsersLeafLet<-dbGetQuery(con, SQL)
Regroupement<-df_postgresUsersLeafLet%>% count(latitude,longitude,city)
})
output$mymap <- renderLeaflet({
leaflet(Regroupement) %>% addTiles() %>% addCircles(lat=~latitude,
lng=~longitude,
radius=~n,
color = "#a500a5", fillOpacity = 0.1)
})
output$dim<-renderUI({selectInput("x","Select one the instance",choices =
df_postListeInstance,selected="NONE",multiple = FALSE)
})
}
shinyApp(ui, server) |