Comments (14)
I first thought that the bug might be caused by wrapping a Shiny gadget in a function, but I cannot replicate the bug by simply wrapping in a function, so failure 1 on correcting.
library(mapview)
library(leaflet)
library(shiny)
library(mapedit)
sf_select <- function(xsf) {selectFeatures(xsf)}
#bsf <- sf_select(breweries91)
library(sf)
library(MODIS)
shp <- system.file("external", "modis_latlonWGS84_grid_world.shp", package = "MODIS")
grd <- st_read(shp)
gsf <- sf_select(grd)
plot(gsf)
but there might be a clue in this failure. If we uncomment the bsf <- ...
line, the Shiny gadget only runs once when run inline.
from mapedit.
@tim-salabim, should we use S3 and change selectFeatures()
to selectMap.sf()
? With resolution of r-spatial/mapview#85, will this become even easier?
from mapedit.
I am not sure. I feel that selectFeatures
is more instructive as the intention is to select features not a map. Wouldn't it make sense to have selectMap
for map objects (leaflet, mapview) and selectFeatures
for spatial objects (sf, sp, ...)?
from mapedit.
@fdetsch, as I look more deeply into the riddle of erratic return, I am even more confused since
x <- MODIS:::mapSelect()
str(x)
works without issue every time for me. I wonder if the error might be caused by some logic in getTile()
, or if perhaps nesting the functions is the source of the trouble. I will keep researching.
from mapedit.
I am starting to suspect dialogViewer
as the potential source of our trouble. In my modules
branch timelyportfolio@b6f0c17, I changed to use the default paneViewer
instead of dialogViewer
. After this change, I can no longer replicate the erratic getTile()
.
# devtools::install_github("timelyportfolio/mapedit@modules")
library(MODIS)
library(leaflet)
library(mapedit)
lapply(1:3, function(x) getTile())
@fdetsch, can you try the above on your end?
from mapedit.
@tim-salabim, if this is the "solution", it will mean we will not be able to use the separate dialog popup. Instead, we will have to use the viewer pane or default browser. Is this acceptable? To see in action, run the following.
# devtools::install_github("timelyportfolio/mapedit@modules")
library(sf)
library(mapview)
library(mapedit)
lapply(1:3, function(x) selectFeatures(st_as_sf(franconia)))
I guess we could add a viewer
argument that gets passed through to selectMap()
. Once we decide how to handle this, we should probably make editMap
consistent.
from mapedit.
@timelyportfolio this is acceptable. I agree that having a viewer
argument would be good so we can control default (pane?) but user can choose to their liking.
I just had a play around and am very impressed! Even things like this work nicely:
leaflet() %>%
addTiles() %>%
addFeatures((sel <<- selectFeatures(franconia)),
popup = popupTable(sel)) %>%
addMouseCoordinates() %>%
addLogo("https://avatars1.githubusercontent.com/u/837910?v=3&s=460")
I think this is nice as it enables people to flexibly set up their workflow.
from mapedit.
@timelyportfolio is it possible to make the map element in the viewer pane automatically resize to the available space?
from mapedit.
Yes I think so but will verify this afternoon.
from mapedit.
I thought I had figured this out at one point, but height="auto"
and height="100%"
both result in blank screens. Unfortunately, while width="100%"
or width="auto"
work as expected, we cannot do the same with height
. I will try a different approach :(
from mapedit.
Sorry for the late reply, guys. German public holidays and stuff...
@timelyportfolio, after adding some missing leaflet::
assignments to R/modules.R (see pull request #28), interactive tile selection through MODIS::getTile()
seems to work permanently. Thanks for the great work!
from mapedit.
I think we can close this. If anybody sees any issues, please reopen. Thanks all!
from mapedit.
@timelyportfolio any news on the issue of making the map element fit the available space in the paneViewer?
from mapedit.
Will resume work on filling height
and so that I don't forget again, file a new issue focused on this behavior.
from mapedit.
Related Issues (20)
- Exporting selected map data in Shiny HOT 3
- Edit existing feature within Shiny and save HOT 7
- Is there a way of flushing the old data from $finished when using singleFeature=TRUE mapedit in a Shiny app? HOT 9
- Load back previously drawn polygons to mapedit map
- editor Module in demo example fails in mapedit 0.6.0 but works in 0.5.0 HOT 2
- selectFeatures draws on world map even if crs = NA (for mode = "click" only) HOT 7
- New feature to download edited data HOT 2
- Click events for leafpm editToolbar buttons HOT 5
- leafpm removes markers added using leafletProxy HOT 2
- Use raster in base map with editMap HOT 2
- Issues installing r-spatial packages HOT 1
- is there a way to display only some of the tools HOT 2
- Is this package still actively developed? HOT 1
- Strange case of difficult viewing HOT 7
- Integration leafmap new feature HOT 17
- 'initBaseMaps' and 'mode = "click"' for selectFeatures
- Warning: `select_()` was deprecated in dplyr 0.7.0. HOT 5
- selectFeatures error possibly related to "draw" mode HOT 3
- mapedit installation on Google colab
- Error triggered by "Clear All" when there are three or more drawn objects.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapedit.