leaflet

tree from array of dot-separated strings

天大地大妈咪最大 提交于 2021-01-29 16:35:37
问题 I have an array of dot delimited strings which looks like the following data = [ 'Europe.UK.London.TrafalgarSq', 'Europe.UK.London.HydePark', 'Europe.UK.London.OxfordStreet', 'Europe.UK.London.City.Bank', 'Europe.France.Paris', 'Europe.France.Bordeaux'}, ] and I want to build the following tree of of nested objects. In case it matters, this is for a leaflet map where the Tree Layers Control is going to be used var tree = { label: 'Places', selectAllCheckbox: 'Un/select all', children: [ {

Layer popups prevented by additional code in onEachFeature

房东的猫 提交于 2021-01-29 15:17:30
问题 Working in leaflet-0.7.3, I have built custom popups using properties of geoJson data using layer.bindPopup in onEachFeature . However I am also attempting to use layer._leaflet_id = feature.properties.fid in onEachFeature in order to make use of a function to move between features with an external control. This function ( clickOnMapItem in the below code extract) works, and I'm intending to make use of it with NEXT and PREVIOUS buttons outside of the map. However after the inclusion of layer

merging palette colors colorRampPalette and plotting with ggplot

本小妞迷上赌 提交于 2021-01-29 15:09:44
问题 I'm trying to replicate using ggplot2 , an earlier question i had using leaflet. I'm trying to merge two palettes where one is used if my variable is below a certain threshold and another if above a certain threshold. As I did with my leaflet question my final plot doesn't seem to be correct. I also want to convert the factor legend to a continuous one. Example code: library(sf) library(leaflet) library(RColorBrewer) # preparing the shapefile nc <- st_read(system.file("gpkg/nc.gpkg", package=

Control the size of popupGraph() from leaflet in r shiny

早过忘川 提交于 2021-01-29 13:53:21
问题 I am having trouble setting my plot width to more than 300px in my popup of my leafletoutput. The height can be set to whatever value, it will work, but it seems like the width is capped to 300px (the extra width will provide a greyed background). Here's the example : library(tidyverse) library(ggplot2) library(shiny) library(leaflet) library(leafpop) id <- c(1,1,1,1,2,2,3,3,3,4) lat <- c(49.823, 49.823, 49.823, 49.823, 58.478, 58.478, 57.478 , 57.478 , 57.478, 38.551) lng <- c(-10.854, -10

How do I create a Leaflet Proxy in observeEvent() for checkboxGroup in R Shiny

人盡茶涼 提交于 2021-01-29 13:31:04
问题 I'm a bit new to R Shiny, and I'm trying to make a simple, dynamic web map in which common users can find where to recycle a variety of materials in Eastern Kentucky. In my sidebar panel in the UI, I made a checkboxGroup, so the user can filter through the recycling centers that allows for the recycling of the materials of their choosing (in this case, which centers recycle glass AND/OR aluminum AND/OR plastics). The checkbox shows up when you run the app, but I get a blank dashboard where

How to use @angular/universal with Leaflet?

≯℡__Kan透↙ 提交于 2021-01-29 11:52:35
问题 Is it possible to use Leaflet with angular/universal? How can I avoid to build Leaflet within server? After npm run build:prod dist folder is generated. But when I run node server.js I get following error: var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer; Window is not defined. 回答1: I solved this by mocking window , navigator and document with Mock Browser Just install the mock browser pacakge npm i mock-browser And add the following code to

Adding custom ActionButtons to popups in leaflet map within shiny app

若如初见. 提交于 2021-01-29 10:49:57
问题 I'm trying to build an app in R shiny where users can learn details about points on a map. When users click on a point, a popup shows some initial details and then an ActionButton (or ActionLink). When the user clicks on that ActionButton, ObserveEvent reactive launches a modal dialog displaying more information about that point. I have the maps, action buttons, and modal dialogs in place. However, I can't figure out how to "assign" each ActionButton to its point/popup on the map. Is there a

How to call fitBounds and getBounds in react-leaflet?

我怕爱的太早我们不能终老 提交于 2021-01-29 09:32:48
问题 I cannot figure out how to call fitBounds() on the Leaflet map. Basically, I am trying to display multiple markers on the map and have the view adjust accordingly (zoom in, zoom out, fly to, etc.). i also saw some example How do you call fitBounds() when using leaflet-react? and i tried to implement but it did not work. Here is my code that i tried. import React, { createRef, Component } from "react"; import { Map, TileLayer, Marker, Popup } from "react-leaflet"; import L from "leaflet";

React-leaflet LayersControl throws error when moving code into function

陌路散爱 提交于 2021-01-29 08:13:37
问题 Sorry if it this has been answered somewhere else before! I am new to react-leaflet and struggle with this issue for some time now. The following code does not compile and and the chrome developer tools tell me: 3 errors on this page: 1) "TypeError: addOverlay is not a function", 2) "TypeError: addOverlay is not a function" and ", 3) "TypeError: this.props.removeLayer is not a function". What I do not understand is: if I comment out the "TestOverlay" component, it compiles. There seems to

Hide table that is created by click-event on leaflet map after data is updated in a shiny app

醉酒当歌 提交于 2021-01-29 07:28:00
问题 I have the shiny app below in which the user uploads a file (here I just put the dt in a reactive function) and from there he can choose which columns he wants to display as selectInput() via a pickerInput() . Then he should be able to click on Update2 and see the map. The user should also be able to update the depth values by multiplying all of them with the numericInput() value1 and create a new sliderInput() and therefore update the dataframe that is displayed in the table as well. These