r leaflet: how to obtain lat/long where marker has been dragged to?
up vote
0
down vote
favorite
in R's version of leaflet, How can I obtain the lat longs of where markers have been dragged to?
library(shiny)
library(leaflet)
library(tidyverse)
ui = fluidPage(
leafletOutput('map'),
textOutput('dragEndLocation')
)
server = function(input, output, session){
output$map = leaflet() %>%
addTiles() %>%
addMarkers(lat = 1,lng = 2, options = markerOptions(draggable = TRUE)
output$dragEndLocation = renderText({
???
})
}
I see in javascript leaflet, there is an event called dragEnd that you can listen for, but it is not implemented in R leaflet. (leaflet.js - Set marker on click, update position on drag)
This person (How to update coordinates after dragging a marker in leaflet shiny?) made a hack-y workaround by listening for input$map_marker_mouseout and then checking if the lat long has changed, but it is not ideal. When you drag a marker very quickly, mouseout will register several times. It is not a problem for this minimal working example, but for my actual application which wants to a slower script after drag end, it makes this workaround very buggy and slow.
Any ideas?
r leaflet
add a comment |
up vote
0
down vote
favorite
in R's version of leaflet, How can I obtain the lat longs of where markers have been dragged to?
library(shiny)
library(leaflet)
library(tidyverse)
ui = fluidPage(
leafletOutput('map'),
textOutput('dragEndLocation')
)
server = function(input, output, session){
output$map = leaflet() %>%
addTiles() %>%
addMarkers(lat = 1,lng = 2, options = markerOptions(draggable = TRUE)
output$dragEndLocation = renderText({
???
})
}
I see in javascript leaflet, there is an event called dragEnd that you can listen for, but it is not implemented in R leaflet. (leaflet.js - Set marker on click, update position on drag)
This person (How to update coordinates after dragging a marker in leaflet shiny?) made a hack-y workaround by listening for input$map_marker_mouseout and then checking if the lat long has changed, but it is not ideal. When you drag a marker very quickly, mouseout will register several times. It is not a problem for this minimal working example, but for my actual application which wants to a slower script after drag end, it makes this workaround very buggy and slow.
Any ideas?
r leaflet
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
in R's version of leaflet, How can I obtain the lat longs of where markers have been dragged to?
library(shiny)
library(leaflet)
library(tidyverse)
ui = fluidPage(
leafletOutput('map'),
textOutput('dragEndLocation')
)
server = function(input, output, session){
output$map = leaflet() %>%
addTiles() %>%
addMarkers(lat = 1,lng = 2, options = markerOptions(draggable = TRUE)
output$dragEndLocation = renderText({
???
})
}
I see in javascript leaflet, there is an event called dragEnd that you can listen for, but it is not implemented in R leaflet. (leaflet.js - Set marker on click, update position on drag)
This person (How to update coordinates after dragging a marker in leaflet shiny?) made a hack-y workaround by listening for input$map_marker_mouseout and then checking if the lat long has changed, but it is not ideal. When you drag a marker very quickly, mouseout will register several times. It is not a problem for this minimal working example, but for my actual application which wants to a slower script after drag end, it makes this workaround very buggy and slow.
Any ideas?
r leaflet
in R's version of leaflet, How can I obtain the lat longs of where markers have been dragged to?
library(shiny)
library(leaflet)
library(tidyverse)
ui = fluidPage(
leafletOutput('map'),
textOutput('dragEndLocation')
)
server = function(input, output, session){
output$map = leaflet() %>%
addTiles() %>%
addMarkers(lat = 1,lng = 2, options = markerOptions(draggable = TRUE)
output$dragEndLocation = renderText({
???
})
}
I see in javascript leaflet, there is an event called dragEnd that you can listen for, but it is not implemented in R leaflet. (leaflet.js - Set marker on click, update position on drag)
This person (How to update coordinates after dragging a marker in leaflet shiny?) made a hack-y workaround by listening for input$map_marker_mouseout and then checking if the lat long has changed, but it is not ideal. When you drag a marker very quickly, mouseout will register several times. It is not a problem for this minimal working example, but for my actual application which wants to a slower script after drag end, it makes this workaround very buggy and slow.
Any ideas?
r leaflet
r leaflet
asked 16 hours ago
Lee88
401415
401415
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370679%2fr-leaflet-how-to-obtain-lat-long-where-marker-has-been-dragged-to%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown