Commit 82ee30ef authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl

first try map

parent c4214565
...@@ -4,6 +4,7 @@ library(jsonlite) ...@@ -4,6 +4,7 @@ library(jsonlite)
library(DT) library(DT)
library(webshot) library(webshot)
library(knitr) library(knitr)
library(leaflet)
server <- function(input, output, session) { server <- function(input, output, session) {
...@@ -34,12 +35,13 @@ server <- function(input, output, session) { ...@@ -34,12 +35,13 @@ server <- function(input, output, session) {
json_data_coco <- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE) json_data_coco <- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE)
coconut.df <<- json_data_coco[["data"]] coconut.df <<- json_data_coco[["data"]]
lastCoConUT <<- inFile$name lastCoConUT <<- inFile$name
print("coconut:") print("coconut:")
#coconut.df$timestamp <- format(coconut.df$timestamp, format="%d-%B-%Y %H:%M:%S") #coconut.df$timestamp <- format(coconut.df$timestamp, format="%d-%B-%Y %H:%M:%S")
print(coconut.df$timestamp) print(coconut.df)
if(is.null(coconut.df$timestamp)){} if(is.null(coconut.df$timestamp)){}
else{unixTime<<-coconut.df$timestamp} else{unixTime<<-coconut.df$timestamp}
...@@ -279,9 +281,20 @@ server <- function(input, output, session) { ...@@ -279,9 +281,20 @@ server <- function(input, output, session) {
status= "warning", status= "warning",
solidHeader = TRUE, solidHeader = TRUE,
collapsible = TRUE, collapsible = TRUE,
plotOutput("plot1", height = 250)) plotOutput("map", height = 250))
})
output$map <- renderPlot({
m <- leaflet()
x=1
m <- addTiles(m)
for(x in 1:length(coconut.df)){
m <- addMarkers(m,lng=in5[x], lat=in6[x]) #addPolylines does not work
x=x+1}
m
}) })
#LINEGRAPH #LINEGRAPH
output$line_box <- renderUI({ output$line_box <- renderUI({
if(input$check_line) if(input$check_line)
...@@ -292,6 +305,27 @@ server <- function(input, output, session) { ...@@ -292,6 +305,27 @@ server <- function(input, output, session) {
plotOutput("plot1", height = 250)) plotOutput("plot1", height = 250))
}) })
# MAP
#function connectTheDots(data){
# c = []
# for(i in data._layers) {
# x = data._layers[i]._latlng.lat;
# y = data._layers[i]._latlng.lng;
# c.push([x, y]);
#}
#return c
#}
#pathCoords = connectTheDots(window.geojson);
#pathLine = L.polyline(pathCoords).addTo(m)
#DownloadButton #DownloadButton
#TODO: MAKE IT WORK! #TODO: MAKE IT WORK!
observeEvent(input$screenshot,{ observeEvent(input$screenshot,{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment