leaflet

Get coordinates from a drawing object from an R leaflet map

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-07 03:38:13
问题 I am building a shiny app where I would like to get the coordinates of a polygon from a leaflet map. Specifically, the shape is drawn using the Drawtoolbar from the leaflet.extras package. A simple example app is below. My question is, how can I get the coordinates from the shape drawn on the map by the user? Thank you in advance. library(shiny) library(leaflet) library(leaflet.extras) # Define UI ui <- fluidPage( leafletOutput("mymap",height=800) ) # Define server logic server <- function

Get coordinates from a drawing object from an R leaflet map

大兔子大兔子 提交于 2021-02-07 03:37:48
问题 I am building a shiny app where I would like to get the coordinates of a polygon from a leaflet map. Specifically, the shape is drawn using the Drawtoolbar from the leaflet.extras package. A simple example app is below. My question is, how can I get the coordinates from the shape drawn on the map by the user? Thank you in advance. library(shiny) library(leaflet) library(leaflet.extras) # Define UI ui <- fluidPage( leafletOutput("mymap",height=800) ) # Define server logic server <- function

Making Leaflet tooltip clickable

好久不见. 提交于 2021-02-04 22:15:13
问题 I want to add tooltips on a Leaflet map (without markers) and make them clickable. The following code adds a tooltip but it's not clickable: var tooltip = L.tooltip({ direction: 'center', permanent: true, interactive: true, noWrap: true, opacity: 0.9 }); tooltip.setContent( "Example" ); tooltip.setLatLng(new L.LatLng(someLat, someLon)); tooltip.addTo(myLayer); tooltip.on('click', function(event) { console.log("Click!"); }); How can I make it work? 回答1: To receive clicks on a L.Tooltip object,

Making Leaflet tooltip clickable

雨燕双飞 提交于 2021-02-04 22:14:46
问题 I want to add tooltips on a Leaflet map (without markers) and make them clickable. The following code adds a tooltip but it's not clickable: var tooltip = L.tooltip({ direction: 'center', permanent: true, interactive: true, noWrap: true, opacity: 0.9 }); tooltip.setContent( "Example" ); tooltip.setLatLng(new L.LatLng(someLat, someLon)); tooltip.addTo(myLayer); tooltip.on('click', function(event) { console.log("Click!"); }); How can I make it work? 回答1: To receive clicks on a L.Tooltip object,

LeafletJS: How to make layer not movable?

可紊 提交于 2021-02-04 19:42:06
问题 I'd like to make a simple canvas layer (not tiled canvases, but one big canvas), but I can not find how can I put layer outside mapPane to make it non-draggable in a documented way. Should I use 'non-documented' methods or should I use 'reverse-tranform' hack ? 回答1: If I understand correctly, you would like to overlay your own canvas onto a Leaflet map, but so that it does not pan (is being dragged) with the rest of the map like the Tile Layers or Markers. Therefore it would be like a Control

Trying to integrate updateTabsetPanel with leaflet marker click in R Shiny?

梦想与她 提交于 2021-02-04 16:40:49
问题 I was wondering if anyone knew a solution to an issue I'm having in Rshiny. In short, I'm looking to have leaflet-based map markers update the user's current tab. Ideally, my group want users to use the map to navigate between statistics exercises, housed within the tabs (exercises not present in this example). The idea is that certain building markers are relevant to certain tabs, and the user looks at the map, sees markers, clicks to find out more (with popup), and the tab below changes

custom marker icon with react-leaflet

我们两清 提交于 2021-02-04 12:59:06
问题 I tried everything I found on the web, Stackoverflow and Github, and I still can't make it. I want to make a custom marker with a custom icon, but with my code below I always got an error : 'TypeError: options.icon.createIcon is not a function' Here is my code (no error on the paths to folders, everything is in src/js or src/img) Icon.js import L from 'leaflet'; const iconPerson = L.Icon.extend({ options: { iconUrl: require('../img/marker-pin-person.svg'), iconRetinaUrl: require('../img

Cache or pre render leaflet map in shiny app

◇◆丶佛笑我妖孽 提交于 2021-02-03 05:58:50
问题 I am trying to map ~8000 polygons using leaflet and run into performance issues. As I am using the map within a shiny app, I was wondering if its possible to somehow cache or pre-render the map. Note that in my case, I have different layers of polygons that are swapped following this approach. A small MWE would be this: The data can be downloaded from here library(shiny) library(leaflet) library(sf) ## Download Shapefile file <- "plz-gebiete.shp" if (!file.exists(file)) { url <- "https://www

Cache or pre render leaflet map in shiny app

爷,独闯天下 提交于 2021-02-03 05:56:53
问题 I am trying to map ~8000 polygons using leaflet and run into performance issues. As I am using the map within a shiny app, I was wondering if its possible to somehow cache or pre-render the map. Note that in my case, I have different layers of polygons that are swapped following this approach. A small MWE would be this: The data can be downloaded from here library(shiny) library(leaflet) library(sf) ## Download Shapefile file <- "plz-gebiete.shp" if (!file.exists(file)) { url <- "https://www

Cache or pre render leaflet map in shiny app

一笑奈何 提交于 2021-02-03 05:56:04
问题 I am trying to map ~8000 polygons using leaflet and run into performance issues. As I am using the map within a shiny app, I was wondering if its possible to somehow cache or pre-render the map. Note that in my case, I have different layers of polygons that are swapped following this approach. A small MWE would be this: The data can be downloaded from here library(shiny) library(leaflet) library(sf) ## Download Shapefile file <- "plz-gebiete.shp" if (!file.exists(file)) { url <- "https://www