Git Product home page Git Product logo

googletooltip's Introduction

GoogleTooltip

Package to generate suggested results of addresses in a textoutput from the google maps API

Note that for this package it is necessary to obtain an API Key from google maps, which can be obtained in the following link.

You can download the package with the following command:

devtools::install_github("Jorge-hercas/GoogleTooltip")

Basic example

if (interactive()) {
library(shiny)
library(ggmap)

key <- "YOUR_API_KEY"

shinyApp(
  ui = fluidPage(
    autocomplete_textOutput(label = "Set a direction", inputId = "direction", key = key),
    verbatimTextOutput("text")
  ),
  server = function(input, output){
    observeEvent(input$direction,{
      output$text <- renderText({
        register_google(key)
        dir <- geocode(location = input$direction)
        if (is.na(dir$lat[1]) == T){
          "No address found"
        }else{
          paste0("lat: ",dir$lat, ", lng: ", dir$lon)
        }
      })
    })
  }
)

}

Grabación de pantalla 2023-06-12 a la(s) 11 01 51

Get yout current location (lat/lng)

library(shiny)

shinyApp(
  ui = fluidPage(
    checkboxInput("input_1", label = "Get directions", value = FALSE),
    uiOutput("actual_dir"),
    verbatimTextOutput("direction")
  ),
  server = function(input, output, session) {
    output$actual_dir <- renderUI({
      if (input$input_1) {
        get_location()
      } else {
        NULL
      }
    })
    observeEvent(input$input_1,{
      lat <- input$lat
      lng <- input$long

      output$direction <- renderText(paste0("lat: ", lat, ", lng: ", lng ))
    })
  }
)

loc

googletooltip's People

Contributors

jorge-hercas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.