├── data ├── images │ ├── resize.sh │ ├── OpenTopoMap │ ├── Esri.WorldImagery │ ├── Esri.NatGeoWorldMap │ ├── Esri.WorldPhysical │ └── OpenMapSurfer.Roads └── README.txt ├── www └── message-handler.js ├── neolithicR.Rproj ├── .gitignore ├── styles.css ├── Dockerfile ├── deps.yaml ├── README.md ├── ui.R ├── server.R └── LICENSE /data/images/resize.sh: -------------------------------------------------------------------------------- 1 | mogrify -resize 200 * -------------------------------------------------------------------------------- /data/README.txt: -------------------------------------------------------------------------------- 1 | The .RData object that is generated from the SQLite-DB for radiocarbon5 is stored here. -------------------------------------------------------------------------------- /data/images/OpenTopoMap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/neolithicR/HEAD/data/images/OpenTopoMap -------------------------------------------------------------------------------- /data/images/Esri.WorldImagery: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/neolithicR/HEAD/data/images/Esri.WorldImagery -------------------------------------------------------------------------------- /data/images/Esri.NatGeoWorldMap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/neolithicR/HEAD/data/images/Esri.NatGeoWorldMap -------------------------------------------------------------------------------- /data/images/Esri.WorldPhysical: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/neolithicR/HEAD/data/images/Esri.WorldPhysical -------------------------------------------------------------------------------- /data/images/OpenMapSurfer.Roads: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/neolithicR/HEAD/data/images/OpenMapSurfer.Roads -------------------------------------------------------------------------------- /www/message-handler.js: -------------------------------------------------------------------------------- 1 | // This recieves messages of type "startmessage" from the server. 2 | Shiny.addCustomMessageHandler("startmessage", 3 | function(message) { 4 | alert(JSON.stringify(message)); 5 | } 6 | ); -------------------------------------------------------------------------------- /neolithicR.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # see https://gist.github.com/octocat/9257657 # 2 | 3 | ###################### 4 | # R files 5 | ###################### 6 | .Rproj.user 7 | .Rhistory 8 | .RData 9 | *.RData 10 | 11 | ###################### 12 | # Shinyapps.io deploy rsconnect 13 | ###################### 14 | modules/radiocarbon5/rsconnect 15 | 16 | ###################### 17 | # genereated reports 18 | ###################### 19 | *.html 20 | *.pdf 21 | 22 | ###################### 23 | # Compiled source 24 | ###################### 25 | *.com 26 | *.class 27 | *.dll 28 | *.exe 29 | *.o 30 | *.so 31 | 32 | ###################### 33 | # Packages 34 | ###################### 35 | *.7z 36 | *.dmg 37 | *.gz 38 | *.iso 39 | *.jar 40 | *.rar 41 | *.tar 42 | *.zip 43 | 44 | ###################### 45 | # Logs and databases 46 | ###################### 47 | *.log 48 | *.sqlite 49 | *.db 50 | neolithicRC/data/*.RData 51 | 52 | ###################### 53 | # OS generated files 54 | ###################### 55 | .DS_Store 56 | .DS_Store? 57 | ._* 58 | .Spotlight-V100 59 | .Trashes 60 | ehthumbs.db 61 | Thumbs.db 62 | 63 | ################# 64 | # buffered data 65 | ################# 66 | *.csv -------------------------------------------------------------------------------- /styles.css: -------------------------------------------------------------------------------- 1 | /* source: https://github.com/rstudio/shiny-examples/blob/master/063-superzip-example/styles.css */ 2 | 3 | .selectize-dropdown-content { 4 | max-height: 600px; 5 | } 6 | 7 | input[type="number"] { 8 | max-width: 80%; 9 | } 10 | 11 | .outer { 12 | position: fixed; 13 | top: 41px; 14 | left: 0; 15 | right: 0; 16 | bottom: 0; 17 | overflow: hidden; 18 | padding: 0; 19 | } 20 | 21 | /* Customize fonts */ 22 | body, label, input, button, select { 23 | font-family: 'Helvetica Neue', Helvetica; 24 | font-weight: 200; 25 | } 26 | h1, h2, h3, h4 { font-weight: 400; } 27 | 28 | .closeopen { 29 | position: absolute; 30 | right: 15px; 31 | top: 0; 32 | background: white; 33 | border: none; 34 | margin: 0; 35 | padding: 0; 36 | } 37 | 38 | #controls { 39 | /* Appearance */ 40 | background-color: white; 41 | padding: 0 20px 20px 20px; 42 | cursor: move; 43 | /* Fade out while not hovering */ 44 | opacity: 0.65; 45 | zoom: 0.9; 46 | transition: opacity 500ms 1s; 47 | } 48 | #controls:hover { 49 | /* Fade in while hovering */ 50 | opacity: 0.95; 51 | transition-delay: 0; 52 | } 53 | 54 | /* If not using map tiles, show a white background */ 55 | .leaflet-container { 56 | background-color: white !important; 57 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/shiny:latest 2 | 3 | MAINTAINER Clemens Schmid 4 | 5 | RUN mkdir /srv/shiny-server/app 6 | COPY . /srv/shiny-server/app 7 | 8 | # create config 9 | RUN echo "run_as shiny; \ 10 | 11 | disable_protocols websocket xhr-streaming xhr-polling iframe-xhr-polling; \ 12 | disable_websockets true; \ 13 | 14 | server { \ 15 | listen 3838; \ 16 | location /cSchmid/neolithicRC { \ 17 | app_dir /srv/shiny-server/app; \ 18 | directory_index off; \ 19 | log_dir /var/log/shiny-server; \ 20 | } \ 21 | }" > /etc/shiny-server/shiny-server.conf 22 | 23 | # if config file exists, then add it, overwriting the sample file 24 | RUN if [ -f /srv/shiny-server/app/shiny-server.conf ]; \ 25 | then (>&2 echo "Using config file inside app directory") \ 26 | && cp /srv/shiny-server/app/shiny-server.conf /etc/shiny-server/shiny-server.conf; \ 27 | fi 28 | 29 | # install necessary system packages 30 | RUN apt-get update -qq \ 31 | && apt-get install -t unstable -y --no-install-recommends \ 32 | libcurl4-openssl-dev \ 33 | libssl-dev \ 34 | libsqlite3-dev \ 35 | libxml2-dev \ 36 | qpdf \ 37 | vim \ 38 | git \ 39 | udunits-bin \ 40 | libproj-dev \ 41 | libgeos-dev \ 42 | libgdal-dev \ 43 | libudunits2-dev \ 44 | libsodium-dev \ 45 | htop \ 46 | nano \ 47 | && apt-get clean \ 48 | && rm -rf /var/lib/apt/lists/ \ 49 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 50 | 51 | # install necessary R packages 52 | RUN R -e "install.packages('automagic')" 53 | RUN R -e "setwd('/srv/shiny-server/app'); automagic::automagic()" 54 | 55 | # give user shiny ability to install new packages and to manipulate data in the app 56 | RUN usermod -a -G staff shiny 57 | RUN chown -R :shiny /srv/shiny-server/app/data 58 | RUN chmod -R 775 /srv/shiny-server/app/data 59 | 60 | # start it 61 | CMD exec shiny-server >> /var/log/shiny-server.log 2>&1 62 | -------------------------------------------------------------------------------- /deps.yaml: -------------------------------------------------------------------------------- 1 | - Package: c14bazAAR 2 | GithubUsername: ISAAKiel 3 | GithubRepo: c14bazAAR 4 | GithubRef: 8e448d8f339be9f90cd10ac3cac01250be814300 5 | GithubSHA1: 8e448d8f339be9f90cd10ac3cac01250be814300 6 | - Package: shiny 7 | Repository: CRAN 8 | Version: 1.0.5 9 | - Package: shinycssloaders 10 | Repository: CRAN 11 | Version: 0.2.0 12 | - Package: leaflet 13 | Repository: CRAN 14 | Version: 1.1.0 15 | - Package: magrittr 16 | Repository: CRAN 17 | Version: '1.5' 18 | - Package: ggplot2 19 | GithubUsername: tidyverse 20 | GithubRepo: ggplot2 21 | GithubRef: 505e4bfb9b9bd7b31f78c273963c46631895257a 22 | GithubSHA1: 505e4bfb9b9bd7b31f78c273963c46631895257a 23 | - Package: gtools 24 | Repository: CRAN 25 | Version: 3.5.0 26 | - Package: DT 27 | Repository: CRAN 28 | Version: '0.4' 29 | - Package: Bchron 30 | Repository: CRAN 31 | Version: 4.2.7 32 | - Package: maps 33 | Repository: CRAN 34 | Version: 3.2.0 35 | - Package: mapproj 36 | Repository: CRAN 37 | Version: 1.2-5 38 | - Package: shinysky 39 | GithubUsername: AnalytixWare 40 | GithubRepo: ShinySky 41 | GithubRef: 242ab164de689c3098967e4af6cf81574ddec5d0 42 | GithubSHA1: 242ab164de689c3098967e4af6cf81574ddec5d0 43 | - Package: dplyr 44 | Repository: CRAN 45 | Version: 0.7.4 46 | - Package: rgdal 47 | Repository: CRAN 48 | Version: 1.2-16 49 | - Package: raster 50 | Repository: CRAN 51 | Version: 2.6-7 52 | - Package: plyr 53 | Repository: CRAN 54 | Version: 1.8.4 55 | - Package: ShinyDash 56 | GithubUsername: trestletech 57 | GithubRepo: ShinyDash 58 | GithubRef: daffe35efdb89faede163832378aca5c88ad1a6c 59 | GithubSHA1: daffe35efdb89faede163832378aca5c88ad1a6c 60 | - Package: sodium 61 | Repository: CRAN 62 | Version: '1.1' 63 | - Package: shinyjs 64 | Repository: CRAN 65 | Version: '1.0' 66 | - Package: devtools 67 | Repository: CRAN 68 | Version: 1.13.5 69 | - Package: crayon 70 | Repository: CRAN 71 | Version: 1.3.4 72 | - Package: purrr 73 | Repository: CRAN 74 | Version: 0.2.4 75 | - Package: tidyr 76 | Repository: CRAN 77 | Version: 0.8.0 78 | - ~ 79 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Project Status: Unsupported – The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired.](https://www.repostatus.org/badges/latest/unsupported.svg)](https://www.repostatus.org/#unsupported) 2 | [![Docker Build Status](https://img.shields.io/docker/build/nevrome/neolithicr.svg)](https://hub.docker.com/r/nevrome/neolithicr/) 3 | [![GitHub contributors](https://img.shields.io/github/contributors/nevrome/neolithicR.svg?maxAge=2592000)](https://github.com/nevrome/neolithicR/graphs/contributors) [![license](https://img.shields.io/badge/license-GPL%202-B50B82.svg)](https://github.com/nevrome/neolithicR/blob/master/LICENSE) 4 | 5 | # WebGIS-App and Search Engine neolithicRC 6 | 7 | Shiny app to search and filter radiocarbon dates from various source databases. neolithicRC is based on the R package [c14bazAAR](https://github.com/ISAAKiel/c14bazAAR). You'll find more information there about 8 | 9 | - the included databases and how to cite (!) them 10 | - the meaning of the variables in the output table 11 | - the methods to compile the data 12 | 13 | You can run this app on your own system by forking and cloning this repository, installing all the necessary packages and running the Shiny app (`R -e "shiny::runApp('.')"`). Alternatively you can use the prebuilt docker image (`docker run --name your_neolithicrc -d -p 3838:3838 nevrome/neolithicr`) or build it yourself (`docker build -t neolithicrc .` and `docker run --name your_neolithicrc -d -p 3838:3838 neolithicrc`). The shiny-server.conf in the docker image is custom-tailored to my needs (location: /cSchmid/neolithicRC and websockets disabled) and you should adjust it if you fork. 14 | 15 | ### Acknowledgements 16 | 17 | Thanks to 18 | 19 | - [Dirk Seidensticker](https://uni-tuebingen.academia.edu/DirkSeidensticker) for significant code contributions. 20 | - [Matthias Lang](http://www.escience.uni-tuebingen.de/mitarbeiter/dr-matthias-lang.html) and [Steve Kaminski](http://www.escience.uni-tuebingen.de/mitarbeiter/dr-steve-kaminski.html) of the [eScience-Center](https://www.uni-tuebingen.de/en/facilities/informations-kommunikations-und-medienzentrum-ikm/escience-center.html) (University of Tübingen) for providing and supporting the virtual server space to host the app until 2019. 21 | - [Christoph Rinne](https://www.ufg.uni-kiel.de/en/staff-directory/scientific-collaborators/christoph-rinne), [Raiko Krauß](https://www.uni-tuebingen.de/en/faculties/faculty-of-humanities/fachbereiche/altertums-und-kunstwissenschaften/ur-und-fruehgeschichte-und-archaeologie-des-mittelalters/early-history/staff/nach-funktion/krauss-raiko-pd-dr.html) and [Jörg Linstädter ](https://www.dainst.org/mitarbeiter-detailansicht/-/person-display/1241013) and especially [Bernhard Weninger](http://ufg.phil-fak.uni-koeln.de/10115.html?&L=0) for discussion and valuable input. 22 | - [Martin Hinz](https://github.com/MartinHinz) for discussion and code review. 23 | - All those researches who share their radiocarbon data in public archives. Open Science for the win! 24 | 25 | ### Project presentations 26 | 27 | - (outdated) [Presentation (11.02.2017) -> neolithicRCpres.](https://github.com/nevrome/neolithicRCpres) 28 | 29 | ### License 30 | 31 | For the code in this project apply the terms and conditions of GNU GENERAL PUBLIC LICENSE Version 2. The datasets are published under different licences. 32 | -------------------------------------------------------------------------------- /ui.R: -------------------------------------------------------------------------------- 1 | #### loading libraries #### 2 | 3 | library(leaflet) 4 | library(ShinyDash) 5 | library(shinysky) 6 | library(DT) 7 | library(shinycssloaders) 8 | 9 | #### definition of frontend output/input #### 10 | shinyUI( 11 | 12 | navbarPage( 13 | "neolithicRC - Search tool for radiocarbon dates", 14 | id = "nav", 15 | 16 | tabPanel("Update Local Database ⛁", 17 | 18 | HTML(' 19 | 20 | Fork me on GitHub 24 | 25 | '), 26 | 27 | shiny::includeMarkdown("README.md"), 28 | 29 | hr(), 30 | 31 | htmlOutput('startmessage'), 32 | br(), 33 | 34 | shinyjs::useShinyjs(), 35 | uiOutput("updateriddle"), 36 | uiOutput("updatebutton"), 37 | br(), br(), 38 | textOutput("c14bazAArout") 39 | ), 40 | 41 | tabPanel("Search and Filter ⌕", 42 | 43 | HTML(' 44 | 45 | Fork me on GitHub 49 | 50 | '), 51 | 52 | fluidRow( 53 | 54 | singleton( 55 | tags$head( 56 | tags$script(src = "message-handler.js"), 57 | tags$style( 58 | HTML(".shiny-notification { 59 | height: 50px; 60 | width: 400px; 61 | position: fixed; 62 | top: calc(50% - 50px);; 63 | left: calc(50% - 200px);; 64 | font-size: 18px; 65 | text-align: center; 66 | }" 67 | ) 68 | ) 69 | ) 70 | ), 71 | 72 | column(2, 73 | 74 | uiOutput("sourcedb_selection") 75 | 76 | ), 77 | 78 | column(2, 79 | 80 | uiOutput("country_selection"), 81 | uiOutput("material_selection") 82 | 83 | ), 84 | 85 | column(2, 86 | 87 | textInput( 88 | "siteselect", 89 | "Site search" 90 | ), 91 | 92 | textInput( 93 | "culselect", 94 | "Period/Culture search" 95 | ) 96 | 97 | ), 98 | 99 | column(2, 100 | 101 | textInput( 102 | "labselect", 103 | "Lab Number search" 104 | ) 105 | 106 | ), 107 | 108 | column(4, 109 | 110 | textOutput('numbertext'), 111 | htmlOutput('originamounttext'), 112 | textOutput('duplitext'), 113 | textOutput('mappingwarning') 114 | 115 | ) 116 | 117 | ), 118 | 119 | uiOutput("age_slider"), 120 | 121 | #datatable output 122 | withSpinner(DT::dataTableOutput("radiodat")), 123 | 124 | #selection buttons and download 125 | downloadButton( 126 | 'downloadseldates', 127 | 'Download current selection as tab separated .csv file' 128 | ) 129 | 130 | ), 131 | 132 | tabPanel("Interactive map ⚆", 133 | 134 | div( 135 | 136 | class="outer", 137 | 138 | # Include custom CSS 139 | tags$head( 140 | includeCSS("styles.css") 141 | ), 142 | 143 | #output of map 144 | leafletOutput( 145 | "radiocarbon", 146 | width = "100%", 147 | height = "100%" 148 | ), 149 | 150 | bootstrapPage( 151 | # Panel 1 (Plots) 152 | absolutePanel( 153 | id = "controls", 154 | class = "panel panel-default", 155 | fixed = TRUE, 156 | draggable = TRUE, 157 | top = 65, 158 | left = "auto", 159 | right = 10, 160 | bottom = "auto", 161 | width = 600, 162 | height = "auto", 163 | 164 | HTML(' 165 | 171 | '), 172 | 173 | div( 174 | 175 | id = 'dataplots', 176 | class = "collapse", # start collapsed 177 | #class="collapse in", # start not collapsed 178 | 179 | br(), 180 | 181 | #period barplot output 182 | withSpinner(plotOutput( 183 | "calplot", 184 | height = "600px", 185 | width = "100%" 186 | )) 187 | ) 188 | ), 189 | 190 | # Panel 2 (Basemap) 191 | absolutePanel( 192 | id = "controls", 193 | class = "panel panel-default", 194 | fixed = TRUE, 195 | draggable = TRUE, 196 | top = 65, 197 | right = "auto", 198 | left = 50, 199 | bottom = "auto", 200 | width = 350, 201 | height = "auto", 202 | 203 | htmlOutput('link'), 204 | 205 | HTML(' 206 | 212 | '), 213 | 214 | div( 215 | 216 | id = 'basemapset', 217 | class = "collapse", # start collapsed 218 | 219 | selectizeInput( 220 | 'basemapselect', 221 | label = NULL, 222 | choices = NULL 223 | ), 224 | 225 | helpText( 226 | "You can change the appearance of this map by replacing the tile source." 227 | ) 228 | ) 229 | ) 230 | ) 231 | ) 232 | ) 233 | ) 234 | 235 | ) 236 | -------------------------------------------------------------------------------- /server.R: -------------------------------------------------------------------------------- 1 | #### Reminders #### 2 | 3 | ## General hints: 4 | 5 | # start app: 6 | # library(shiny) 7 | # runApp("modules/radiocarbon5/", launch.browser=TRUE) 8 | 9 | # push to shinyapps.io: 10 | # library(rsconnect) 11 | # deployApp() 12 | 13 | # install all necessary packages: 14 | # automagic::make_deps_file() 15 | # automagic::automagic() 16 | 17 | ## Setup on server 134.2.24.118 18 | 19 | # traditional setup: 20 | # push data: scp -r -P PORTNUMBER /home/clemens/Rstats/neolithicR/* USERNAME@134.2.2.137:/home/USERNAME/ShinyApps/neolithicRC/ 21 | # restart server: sudo systemctl restart shiny-server 22 | # config file: /etc/shiny-server/shiny-server.conf 23 | 24 | # docker setup: 25 | # build docker container: docker build -t neol . 26 | # run docker container: docker run --name neo -d -p 3838:3838 neol 27 | # install docker on CentOS: https://docs.docker.com/install/linux/docker-ce/centos/#upgrade-docker-ce 28 | # pull latest version of image: 29 | # docker pull nevrome/neolithicr 30 | # install and run docker container from dockerhub: 31 | # docker run --restart=always --name neolithicrc -d -p 3838:3838 nevrome/neolithicr 32 | 33 | #### loading libraries #### 34 | 35 | library(shiny) 36 | library(leaflet) 37 | library(magrittr) 38 | library(ggplot2) 39 | library(gtools) 40 | library(DT) 41 | library(Bchron) 42 | library(maps) 43 | library(mapproj) 44 | library(shinysky) 45 | library(dplyr) 46 | library(rgdal) 47 | library(raster) 48 | library(plyr) 49 | library(ShinyDash) 50 | library(sodium) 51 | 52 | #### loading data #### 53 | 54 | data(intcal13) 55 | 56 | #### helper functions #### 57 | 58 | prep_dataset <- function() { 59 | c14bazAAR::get_all_dates() %>% 60 | # dplyr::sample_n(500) %>% 61 | # c14bazAAR::as.c14_date_list() %>% 62 | c14bazAAR::mark_duplicates() %>% 63 | c14bazAAR::classify_material() %>% 64 | c14bazAAR::coordinate_precision() %>% 65 | c14bazAAR::finalize_country_name() %>% 66 | c14bazAAR::calibrate(choices = c("calprobdistr", "calrange")) %>% 67 | dplyr::arrange(dplyr::desc(c14age)) %>% 68 | return() 69 | } 70 | 71 | #### server output #### 72 | 73 | shinyServer(function(input, output, session) { 74 | 75 | 76 | # loading data 77 | shiny::withProgress(message = 'Loading data...', value = 0, { 78 | shiny::incProgress(0.1) 79 | last_updated <- "not available - please update" 80 | if (file.exists("data/c14data2.RData") & file.exists("data/last_updated.RData")) { 81 | load(file = "data/c14data2.RData") 82 | dates <- datestable 83 | load(file = "data/last_updated.RData") 84 | } 85 | shiny::incProgress(1) 86 | }) 87 | 88 | # render start message 89 | output$startmessage = renderPrint({ 90 | HTML("Last data update: ", paste(last_updated)) 91 | }) 92 | 93 | # update riddle to hide update button 94 | output$updateriddle <- renderUI({ 95 | list( 96 | HTML("You can rebuild the database if you know the secret passphrase:"), 97 | passwordInput("updateriddleanswer", NULL) 98 | ) 99 | }) 100 | 101 | # secret passphrase encrypted by sodium::password_store() 102 | passphrase <- "$7$C6..../....KJmqQLQZdPEkNIEf7L65NGM6JZx5awzmpsrk3sFk7E2$Dv893Y6Eu8HVUoIrtV1PQ2v4.oRbv7kzG9z4c9tKjlC" 103 | 104 | # hide user update button on condition 105 | output$updatebutton <- renderUI({ 106 | if (!is.null(input$updateriddleanswer)) { 107 | if(sodium::password_verify(passphrase, input$updateriddleanswer)) { 108 | return(actionButton("updatedb", "Update neolithicRC local database")) 109 | } 110 | } 111 | }) 112 | 113 | # allow data update by user 114 | observeEvent({input$updatedb}, { 115 | shiny::withProgress(message = 'Updating database...', value = 0, { 116 | withCallingHandlers({ 117 | 118 | shinyjs::html("Routput", "") 119 | 120 | message(" 121 | Install latest version of c14bazAAR (from 122 | github.com/ISAAKiel/c14bazAAR) 123 | and all its dependencies.") 124 | 125 | devtools::install_github( 126 | "ISAAKiel/c14bazAAR", 127 | dependencies = TRUE, 128 | upgrade_dependencies = TRUE, 129 | force = TRUE, 130 | force_deps = TRUE, 131 | quick = TRUE, 132 | quiet = TRUE 133 | ) 134 | 135 | shiny::incProgress(0.2) 136 | 137 | message("Update internal database. This may take up to 30 minutes.") 138 | 139 | datestable <- prep_dataset() 140 | 141 | shiny::incProgress(0.9) 142 | 143 | save(datestable, file = "data/c14data2.RData") 144 | last_updated <- Sys.time() 145 | save(last_updated, file = "data/last_updated.RData") 146 | 147 | dates <- datestable 148 | 149 | shiny::incProgress(1) 150 | 151 | message( 152 | " 153 | Done. Restart neolithicRC to work with the new data ↻ 154 | " 155 | ) 156 | }, 157 | message = function(m) { 158 | shinyjs::html( 159 | id = "c14bazAArout", 160 | html = paste0(crayon::strip_style(m$message), "
"), 161 | add = TRUE) 162 | }, 163 | warning = function(m) { 164 | shinyjs::html( 165 | id = "c14bazAArout", 166 | html = paste0("", m$message, "
"), 167 | add = TRUE) 168 | }) 169 | }) 170 | }) 171 | 172 | #### render controls #### 173 | 174 | output$sourcedb_selection <- renderUI({ 175 | select2Input( 176 | "originselect", 177 | "Data source selection", 178 | choices = unique(dates$sourcedb), 179 | selected = unique(dates$sourcedb), 180 | type = c("input"), 181 | width = "100%" 182 | ) 183 | }) 184 | 185 | output$country_selection <- renderUI({ 186 | select2Input( 187 | "countryselect", 188 | "Country selection", 189 | choices = sort(unique(dates$country_final)), 190 | type = c("input"), 191 | width = "100%" 192 | ) 193 | }) 194 | 195 | output$material_selection <- renderUI({ 196 | select2Input( 197 | "materialselect", 198 | "Material selection", 199 | choices = sort(unique(dates$material_thes)), 200 | type = c("input") 201 | ) 202 | }) 203 | 204 | output$age_slider <- renderUI({ 205 | sliderInput( 206 | "range", 207 | "uncalibrated age BP:", 208 | width = "100%", 209 | min = min(dates$c14age, na.rm = TRUE), 210 | max = max(dates$c14age, na.rm = TRUE), 211 | step= 10, 212 | value = c(min(dates$c14age), max(dates$c14age)) 213 | ) 214 | }) 215 | 216 | # change to map view directly after start to preload map 217 | #updateTabsetPanel(session, "nav", selected = "Interactive map") 218 | 219 | #reactive dataset selection based on user choice 220 | datasetInput <- reactive({ 221 | 222 | # wait for input to load 223 | req( 224 | input$originselect, 225 | input$range 226 | ) 227 | 228 | # prepare input 229 | sel_country <- input$countryselect 230 | if(length(sel_country) == 0){ 231 | sel_country <- unique(dates$country_final) 232 | } 233 | 234 | sel_material <- input$materialselect 235 | if(length(sel_material) == 0){ 236 | sel_material <- unique(dates$material_thes) 237 | } 238 | 239 | labterm = input$labselect 240 | if (labterm != "") { 241 | lnv <- grep(paste("(", labterm, ")+", sep = ""), dates$labnr, ignore.case = TRUE) 242 | dates <- dates[lnv, ] 243 | } 244 | 245 | siteterm = input$siteselect 246 | if (siteterm != "") { 247 | sv <- grep(paste("(", siteterm, ")+", sep = ""), dates$site, ignore.case = TRUE) 248 | dates <- dates[sv, ] 249 | } 250 | 251 | culterm = input$culselect 252 | if (culterm != "") { 253 | pev <- grep(paste("(", culterm, ")+", sep = ""), dates$period, ignore.case = TRUE) 254 | cuv <- grep(paste("(", culterm, ")+", sep = ""), dates$culture, ignore.case = TRUE) 255 | pecuv <- unique(c(pev, cuv)) 256 | dates <- dates[pecuv, ] 257 | } 258 | 259 | # preselection for dates with no age: 260 | # only include them if the user didn't make any concious age selection 261 | # or: only apply normal filter if the user makes any decision 262 | if (min(dates$c14age, na.rm = TRUE) != input$range[1] | 263 | max(dates$c14age, na.rm = TRUE) != input$range[2]) { 264 | dates <- dates %>% dplyr::filter( 265 | c14age >= input$range[1] & c14age <= input$range[2] 266 | ) 267 | } 268 | 269 | # selection of data 270 | dates <- dplyr::filter( 271 | dates, 272 | sourcedb %in% input$originselect & 273 | country_final %in% sel_country & 274 | material_thes %in% sel_material 275 | ) 276 | 277 | }) 278 | 279 | #rendering calibration plot for output 280 | output$calplot <- renderPlot({ 281 | 282 | # data prep 283 | date_segments <- datasetInput() %>% 284 | dplyr::select(c14age, calrange) %>% 285 | dplyr::filter(purrr::map_lgl(calrange, function(x){nrow(x) > 0})) %>% 286 | tidyr::unnest() 287 | 288 | date_dens <- datasetInput() %>% 289 | dplyr::select(calprobdistr) %>% 290 | dplyr::filter(purrr::map_lgl(calprobdistr, function(x){nrow(x) > 0})) %>% 291 | tidyr::unnest() %>% 292 | dplyr::group_by(calage) %>% 293 | dplyr::summarise(dens = sum(density)) 294 | 295 | # density sum plot 296 | dens_sum_plot <- ggplot(date_dens, aes(x = calage, y = dens)) + 297 | geom_line( 298 | color = "red" 299 | ) + 300 | labs( 301 | y = "", 302 | x = "calibrated Age BP" 303 | ) + 304 | scale_x_reverse(limits = c(max(date_dens$calage), min(date_dens$calage))) + 305 | ggtitle("Density sum of date selection") + 306 | theme_bw() 307 | 308 | # calibration plot 309 | cal_plot <- ggplot() + 310 | ggtitle("Calibration Overview") + 311 | xlab("calibrated Age BP") + 312 | ylab("C14 Age BP") + 313 | theme_bw() + 314 | geom_smooth(data = intcal13, aes(y = V2, x = V1), color = "darkgreen") + 315 | scale_x_reverse(limits = c(max(date_dens$calage), min(date_dens$calage))) + 316 | annotate( 317 | "text", x = Inf, y = -Inf, hjust = -0.2, vjust = -5, 318 | label = "Spline based on IntCal13", 319 | size = 5, color = "darkgreen" 320 | ) + 321 | annotate( 322 | "text", x = Inf, y = -Inf, hjust = -0.3, vjust = -3, 323 | label = "www.radiocarbon.org", 324 | size = 5, color = "darkgreen" 325 | ) 326 | 327 | # add data 328 | if (nrow(dates) > 0) { 329 | 330 | cal_plot <- cal_plot + 331 | geom_segment( 332 | aes( 333 | x = from, 334 | y = c14age, 335 | xend = to, 336 | yend = c14age 337 | ), 338 | data = date_segments 339 | ) + 340 | #ylim(min(date_segments$c14age) - 200, max(date_segments$c14age) + 200) + 341 | geom_rug(aes(y = c14age), data = date_segments) 342 | 343 | } 344 | 345 | grid::grid.newpage() 346 | grid::grid.draw(rbind(ggplotGrob(dens_sum_plot), ggplotGrob(cal_plot), size = "last")) 347 | 348 | }) 349 | 350 | # prepare the pictures for the basemap select input 351 | mapurl <- session$registerDataObj( 352 | 353 | name = 'basemapselection', 354 | data = NULL, 355 | 356 | filter = function(data, req) { 357 | 358 | query <- parseQueryString(req$QUERY_STRING) 359 | base <- query$base 360 | 361 | # save picture to a temporary PNG file 362 | image <- tempfile() 363 | tryCatch({ 364 | png(image, width = 200, height = 100, bg = 'transparent') 365 | paste0("data/images/", base) %>% 366 | brick %>% 367 | plotRGB 368 | }, finally = dev.off()) 369 | 370 | # send the PNG image back in a response 371 | shiny:::httpResponse( 372 | 200, 'image/png', readBin(image, 'raw', file.info(image)[, 'size']) 373 | ) 374 | 375 | } 376 | ) 377 | 378 | # update the render function for the basemap select input 379 | updateSelectizeInput( 380 | session, 'basemapselect', server = TRUE, 381 | choices = c( 382 | "Esri.WorldImagery", 383 | "Esri.WorldPhysical", 384 | "Esri.NatGeoWorldMap", 385 | "OpenTopoMap", 386 | "OpenMapSurfer.Roads" 387 | ), 388 | selected = "Esri.WorldImagery", 389 | options = list(render = I(sprintf( 390 | "{ 391 | option: function(item, escape) { 392 | return '
' + 394 | escape(item.value) + '
'; 395 | } 396 | }", 397 | mapurl 398 | ))) 399 | ) 400 | 401 | #rendering the map file for output 402 | output$radiocarbon = renderLeaflet({ 403 | 404 | withProgress(message = 'Loading map...', value = 0, { 405 | 406 | # tile source switch 407 | tiles <- switch( 408 | input$basemapselect, 409 | "Esri.WorldImagery" = {"http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"}, 410 | "Esri.WorldPhysical" = {"https://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}"}, 411 | "OpenTopoMap" = {"http://{s}.tile.opentopomap.org/{z}/{x}/{y}.png"}, 412 | "OpenMapSurfer.Roads" = {"http://korona.geog.uni-heidelberg.de/tiles/roads/x={x}&y={y}&z={z}"}, 413 | "Esri.NatGeoWorldMap" = {"http://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}"} 414 | ) 415 | 416 | #define sources (static, then dynamic) 417 | att <- "" 418 | seldata <- datasetInput() 419 | 420 | seldata <- filter( 421 | seldata, 422 | !is.na(lat) & !is.na(lon) 423 | ) 424 | 425 | setProgress(value = 0.3) 426 | 427 | #text popup definition 428 | site.popup <- paste0( 429 | "Data Source: ", 430 | seldata$sourcedb, 431 | "
Site: ", 432 | seldata$site, 433 | "
Lab number: ", 434 | seldata$labnr, 435 | "
Age: ", 436 | seldata$c14age, "calBP", 437 | "
Reference: ", 438 | seldata$shortref 439 | ) 440 | 441 | #preparation of mapping for shiny frontend 442 | mapres <- leaflet(seldata) %>% 443 | addTiles( 444 | urlTemplate = tiles, 445 | attribution = att) %>% 446 | addMarkers( 447 | lat = seldata$lat, 448 | lng = seldata$lon, 449 | popup = site.popup, 450 | clusterOptions = markerClusterOptions() 451 | ) 452 | 453 | setProgress(value = 1) 454 | 455 | return(mapres) 456 | }) 457 | }) 458 | 459 | #render datatable, that shows the currently mapped dates 460 | output$radiodat = renderDataTable({ 461 | 462 | tab <- datasetInput()[,c( 463 | "sourcedb", 464 | "labnr", 465 | "c14age", 466 | "c14std", 467 | "lat", 468 | "lon", 469 | "country_final", 470 | "site", 471 | "period", 472 | "culture", 473 | "material_thes", 474 | "shortref", 475 | "duplicate_group" 476 | )] 477 | 478 | DT::datatable(tab) # %>% 479 | # DT::formatStyle( 480 | # 'duplicate_group', 481 | # 'duplicate_group', 482 | # backgroundColor = DT::styleEqual( 483 | # unique(tab$duplicate_group), 484 | # ifelse( 485 | # is.na(unique(tab$duplicate_group)), 486 | # "white", 487 | # "red" 488 | # ) 489 | # ) 490 | # ) 491 | 492 | }) 493 | 494 | #render textelements 495 | output$numbertext = renderPrint({ 496 | cat(nrow(datasetInput()), " of ", nrow(dates), " dates are selected.") 497 | }) 498 | 499 | output$numbertext2 = renderPrint({ 500 | cat(nrow(datasetInput()), " selected") 501 | }) 502 | 503 | output$originamounttext = renderPrint({ 504 | linklist <- unique(datasetInput()$sourcedb) %>% 505 | mapvalues( 506 | from = c("AustArch", "14SEA", "RADON", "RADON-B", "aDRAC", "EUROEVOL", "CALPAL", "CONTEXT", "KITEeastafrica"), 507 | to = c( 508 | "KITEeastafrica", 509 | "AustArch", 510 | "14SEA", 511 | "RADON", 512 | "RADON-B", 513 | "aDRAC", 514 | "EUROEVOL", 515 | "CALPAL", 516 | "CONTEXT" 517 | ), 518 | warn_missing = FALSE 519 | ) 520 | 521 | HTML( 522 | "The selected dates are from the following source databases: ", 523 | "
", 524 | paste(linklist, collapse = ' ') 525 | ) 526 | }) 527 | 528 | output$duplitext = renderPrint({ 529 | HTML( 530 | sum(!is.na(datasetInput()$duplicate_group)), 531 | " of these dates are duplicates. Their labnr appears more than once." 532 | ) 533 | }) 534 | 535 | output$mappingwarning = renderPrint({ 536 | if (nrow(datasetInput()) > 10000) { 537 | cat("⚠ You've selected more than 10000 individual dates - depending on your browser and your internet connection that could cause neolithicRC to react pretty slowly.") 538 | } 539 | }) 540 | 541 | output$link = renderPrint({ 542 | HTML("tile source list") 543 | }) 544 | 545 | #render data-download 546 | output$downloadseldates = downloadHandler( 547 | filename = function() { 548 | 549 | paste( 550 | "dateselection", 551 | '.csv' 552 | ) 553 | 554 | }, 555 | content = function(file) { 556 | 557 | # remove list columns 558 | tab <- datasetInput() %>% dplyr::select( 559 | -calprobdistr, -calrange, -sigma 560 | ) 561 | 562 | write.table( 563 | tab, 564 | file, 565 | dec = ".", 566 | sep = '\t', 567 | col.names = TRUE, 568 | row.names = FALSE, 569 | eol = "\n", 570 | qmethod = "double" 571 | ) 572 | 573 | } 574 | ) 575 | 576 | }) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | --------------------------------------------------------------------------------