Data Blast

Data, Telecom, Maths, Astronomy, Origami, and so on

Remembering “The Way of St. James” ( and The_Way R Shiny App)

1 Comment

People say there is a before and after of “The Way”. I can’t make sure it’s true (for everybody), but I know that the way has something that catches the pilgrim. Although one exact month has already passed since my wonderful and exciting trip through a part of way of St. James from Leon (French way), I still keep thinking about it. For me, it was an extraordinary and vital experience; two weeks where I met many people from different countries, all united by a common goal: to reach Santiago. I shared many experiences, joys and sorrows, wishes and hopes, some philosophical conversations and others more mundane, but mostly I met wonderful and endearing friends that until today, fortunately, I keep being in touch thanks to the email and whatsapp.

When I started the way, of course, had many doubts and fears of what I would find there. A week before, I remember I read a quote, which initially didn’t pay much attention but during the path, I realized that it had all the sense: “The way is never long if beside you goes a good friend”. This phrase I think encompasses the sense of the way, something like the hymn of Liverpool “You’ll never walk alone” haha Actually, I practice regularly trekking but for some reason, for several months I was not able to do it and my feet were the first to notice it: the fearsome blisters (which came to be raw, oops)…..simply I’m a rookie. Here I also must say that only thanks to encouragment words from kind travel-mates I was able to finish the journey and reach my initial goal.

p1_tw

Well, my intention, however, isn’t to mystify the way because each person will give the sense that he or she wants, but I must recognize that “The Way” isn’t an ordinary path, has “an aura” that makes it special. I mean, unlike other routes I’ve done, here there is a great willingness for talking and sharing and the only keyword to start a conversation is a simple phrase: Buen Camino!!!!. Moreover, in an astonishing way, language barriers disappear because you have all the time, people can practice the patience and the tolerance, and finally somehow people understand each other; I myself was witness to idiomatic miracles like this. On the other hand, wonderful landscapes and monuments make this a worthwhile adventure and an unforgettable experience despite the effort made. Hopefully, next year I wish to go back…maybe by the Northern way or French way but now from Saint Jean; only time will tell. Finally from here, I’d like to send greetings to all my friends at the way: Italian team and friends from Seville, Navarra, Galicia, Canary Islands, France, Poland, etc. etc. Meanwhile, I’m practicing from now the hymn: “Tous les matins nous prenons le chemin, tous les matins nous allons plus loin……… Ultreia, ultreia et suseia.”.

p6_land

The_ Way R Shinny App

Coming back to the reality (or at least I’m trying), these last days I was considering to make a simple web app using R Shiny which is made up of three parts: Map, Altitude, and Distance. Map section shows the paths and some markers by using leaflet library and kml files. I should have liked to use mapbox.js library in order to control layers in the map, but I had problems in the integration with R Shiny. In the Altitude section, I used morris.js (rCharts package) and rgbif package based on Google Elevation API to calculate elevation from gps coordinates. Finally, Distance section shows a distance table for a specific site. Github link.

the_way_shiny

ui.R

library(shiny)
library(rCharts)
shinyUI(fluidPage(
    titlePanel("St. James's Way (The French Way)"),
    sidebarLayout(
    sidebarPanel(
    selectInput("var1", label = "Choose a Stage:",choices = s$id,selected = "stage1"),
    selectInput("var2",label = "Choose a Site:", choices = cam$Site, selected = "Saint Jean Pied de Port"),
        br(),
        br(),
        br(),
        br(),
        img(src = "camino.png", height = 72, width = 72),
        span("by Andre", style = "color:blue")
        ),
    mainPanel(
    tabsetPanel(
    tabPanel("Map", tags$style('.leaflet {height: 400px;}'),
    showOutput('mapPlot','leaflet')),
    tabPanel("Altitude", textOutput("text1"),showOutput("plot1", lib = "morris")),
    tabPanel("Distance",textOutput("text2"),tableOutput ("tab2"),tableOutput ("tab1"))
  )))))

server.R

library(shiny)
library(rCharts)
library(rMaps)
shinyServer(function(input, output,session) {
    dinput <- reactive({switch(input$var1,,"stage1"= s1,"stage2"= s2,"stage3"= s3,"stage4"= s4,
    "stage5"= s5,"stage6"= s6,"stage7"=s7,"stage8"= s8,"stage9"= s9,"stage10"= s10,"stage11"= s11,
    "stage12"= s12,"stage13"= s13,"stage14"= s14,"stage15"= s15,"stage16"= s16,"stage17"= s17,
    "stage18a"= s18a,"stage18b"= s18b,"stage19"= s19,"stage20"=s20,"stage21"= s21,"stage22a"= s22a,
    "stage22b"= s22b,"stage23a"= s23a,"stage23b"= s23b,"stage24"= s24,"stage25"= s25,"stage26"= s26,
    "stage27a"= s27a,"stage27b"= s27b,"stage28a"= s28a,"stage28b"= s28b,"stage29"= s29,"stage30"= s30,
    "stage31"= s31,"stage32"= s32,"stage33"= s33)})
    output$text1 <- renderText({s$name[s$id == input$var1]})
    output$text2 <- renderText({input$var2})
    output$plot1 <- renderChart({
        di<-dinput()
        m2<-mPlot(x='index',y='alt', type = "Line", data = di)
        m2$set(pointSize = 0, lineWidth = 1)
        m2$set(hoverCallback = "#! function(index, options, content){
        var row = options.data[index]
        return '<b>' + 'Altitude' + '</b>' + '<br/>' +
        'alt: ' + row.alt + '<br/>'
        } !#")
        m2$set(dom='plot1')
        return(m2)
    })
    output$mapPlot <- renderUI({
        map1 = Leaflet$new()
        map1$tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png")
        map1$addKML('leaflet/paths.kml')
        for (i in (1:dim(ps)[1])) {
        map1$marker(c(ps[i,3], ps[i,2]), bindPopup = ps[i,1])
        }
        HTML(map1$html(chartId = "mapPlot"))
    })
     output$tab1 <- renderTable({
        df1=subset(cam, index >= cam$index[cam$Site == input$var2])[,1:2]
        df1[1,2]<-0
        colnames(df1)<-c('Name','Distance (Km)')
        return(df1)
    })
     output$tab2 <- renderTable({
        g=cam$Total[cam$Site == input$var2]
        df2<-data.frame('from'= g, 'to'= (sum(cam$Partial)-g))
        colnames(df2)<-c('Distance from Saint Jean (Km)','Distance to Santiago (Km)')
    return(df2)
    })
  })

PS. I have pending to write about Origami, another of my hobbies, but still cannot set a idea. I continue reading “Origami Design Secrets: Mathematical Methods for an Ancient Art” by Robert J. Lang. Now, I have a sketch but need to spend more time in Treemaker and Oripa. BTW, here is the Origami Kit for “The Way”: a shell (vieira) and an arrow.

Pilgrim_Origami

Advertisements

One thought on “Remembering “The Way of St. James” ( and The_Way R Shiny App)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s