leaflet

Coordinate Reflection issue with Leaflet

ε祈祈猫儿з 提交于 2021-02-10 06:11:59
问题 Salutations all and happy holidays. I Noticed an interesting behavioral quirk while trying to draw polygon layers with L.geoJson(). consider the following code: var polygonCoords = [ {"type": "Feature", "properties": {"group": "Violations"}, "geometry": { "type" : "Polygon", "coordinates": [[ [-107.69348, 43.22519], [-105.48523, 42.99259], [-107.7594, 42.26105] ]] } }]; and var polygons = L.polygon([ [43.22519, -107.69348], [42.99259, -105.48523], [42.26105, -107.7594] ]); Now, both work in

Leaflet draw edit control custom text

懵懂的女人 提交于 2021-02-10 05:31:47
问题 I'd like to change the options text from edit control at Leaflet Draw. So instead of Save | Cancel | Clear All Display this text in another language. Same on the tooltips. Is it possible? 回答1: I solved in this way. L.drawLocal = { draw: { toolbar: { // #TODO: this should be reorganized where actions are nested in actions // ex: actions.undo or actions.cancel actions: { title: 'Cancel - your text-', text: '- your text-' }, finish: { title: '- your text-', text: '- your text-' }, undo: { title:

React leaflet center attribute does not change when the center state changes

旧时模样 提交于 2021-02-08 19:58:53
问题 App.js import { useState } from 'react'; const App = () => { // This state is used to the center attribute of MapContainer component const [mapCenter, setMapCenter] = useState([34.80746, -40.4796]); // This state is used to the zoom attribute of MapContainer component const [mapZoom, setMapZoom] = useState(3); const onClickHandler = () => { setMapCenter([20, 100]); setMapZoom(5); }; return ( <> <button onClick={onClickHandler}>Change map's center location</button> <Map center={mapCenter} zoom

React leaflet center attribute does not change when the center state changes

徘徊边缘 提交于 2021-02-08 19:58:19
问题 App.js import { useState } from 'react'; const App = () => { // This state is used to the center attribute of MapContainer component const [mapCenter, setMapCenter] = useState([34.80746, -40.4796]); // This state is used to the zoom attribute of MapContainer component const [mapZoom, setMapZoom] = useState(3); const onClickHandler = () => { setMapCenter([20, 100]); setMapZoom(5); }; return ( <> <button onClick={onClickHandler}>Change map's center location</button> <Map center={mapCenter} zoom

Placing leaflet controls side-by-side instead of vertically stacked in R/Shiny with HTML/CSS

一个人想着一个人 提交于 2021-02-08 17:28:05
问题 What I want to do is pretty simple: I want my leaflet controls to be aligned side-by-side in rows rather than vertically as columns (as leaflet automatically does). Here is some short example code: library(shiny) library(leaflet) shinyApp( ui <- fluidPage( leafletOutput("map", width = "100%"), tags$head(tags$style(HTML(".leaflet-control-layers-overlays {width: 190px;}"))) ), server <- function(session, input, output){ output$map <- renderLeaflet({ leaflet() %>% addProviderTiles("Esri

Placing leaflet controls side-by-side instead of vertically stacked in R/Shiny with HTML/CSS

徘徊边缘 提交于 2021-02-08 17:27:19
问题 What I want to do is pretty simple: I want my leaflet controls to be aligned side-by-side in rows rather than vertically as columns (as leaflet automatically does). Here is some short example code: library(shiny) library(leaflet) shinyApp( ui <- fluidPage( leafletOutput("map", width = "100%"), tags$head(tags$style(HTML(".leaflet-control-layers-overlays {width: 190px;}"))) ), server <- function(session, input, output){ output$map <- renderLeaflet({ leaflet() %>% addProviderTiles("Esri

Placing leaflet controls side-by-side instead of vertically stacked in R/Shiny with HTML/CSS

橙三吉。 提交于 2021-02-08 17:26:55
问题 What I want to do is pretty simple: I want my leaflet controls to be aligned side-by-side in rows rather than vertically as columns (as leaflet automatically does). Here is some short example code: library(shiny) library(leaflet) shinyApp( ui <- fluidPage( leafletOutput("map", width = "100%"), tags$head(tags$style(HTML(".leaflet-control-layers-overlays {width: 190px;}"))) ), server <- function(session, input, output){ output$map <- renderLeaflet({ leaflet() %>% addProviderTiles("Esri

R leaflet - Show/Hide addControl() element with group layers

前提是你 提交于 2021-02-08 16:57:44
问题 I have a leaflet map which uses a custom legend using HTML and added using the addControl function (following: Leaflet Legend for Custom Markers in R). However, I only want the legend to show when one group is shown, I have tried using the argument group = "group name" which doesn't work with the addControl function. I've also tried using layerId arguments but without success. Any ideas? Reproducible example: library(leaflet) # Sample Data data(quakes) quakes <- quakes[1:10,] # Choose Icon:

How to prevent event bubbling on child of React-Leaflet Map

[亡魂溺海] 提交于 2021-02-08 14:10:42
问题 I have a React-Leaflet map which I am rendering a div inside. For some reason, interacting with the contents of the div causes the map beneath to respond (eg: double-clicking will zoom the map, dragging will pan the map) - even when I'm calling e.stopPropagation() in handlers attached to the div. As I understand it, calling stopPropagation() should prevent the DOM events from ever reaching the map itself. Why does it appear that stopPropagation() is being ignored? How can I render a div

How to prevent event bubbling on child of React-Leaflet Map

白昼怎懂夜的黑 提交于 2021-02-08 14:07:59
问题 I have a React-Leaflet map which I am rendering a div inside. For some reason, interacting with the contents of the div causes the map beneath to respond (eg: double-clicking will zoom the map, dragging will pan the map) - even when I'm calling e.stopPropagation() in handlers attached to the div. As I understand it, calling stopPropagation() should prevent the DOM events from ever reaching the map itself. Why does it appear that stopPropagation() is being ignored? How can I render a div