GithubHelp home page GithubHelp logo

Comments (14)

timelyportfolio avatar timelyportfolio commented on July 24, 2024

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.

timelyportfolio avatar timelyportfolio commented on July 24, 2024

@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.

tim-salabim avatar tim-salabim commented on July 24, 2024

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.

timelyportfolio avatar timelyportfolio commented on July 24, 2024

@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.

timelyportfolio avatar timelyportfolio commented on July 24, 2024

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.

timelyportfolio avatar timelyportfolio commented on July 24, 2024

@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.

tim-salabim avatar tim-salabim commented on July 24, 2024

@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.

tim-salabim avatar tim-salabim commented on July 24, 2024

@timelyportfolio is it possible to make the map element in the viewer pane automatically resize to the available space?

from mapedit.

timelyportfolio avatar timelyportfolio commented on July 24, 2024

Yes I think so but will verify this afternoon.

from mapedit.

timelyportfolio avatar timelyportfolio commented on July 24, 2024

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.

fdetsch avatar fdetsch commented on July 24, 2024

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.

timelyportfolio avatar timelyportfolio commented on July 24, 2024

I think we can close this. If anybody sees any issues, please reopen. Thanks all!

from mapedit.

tim-salabim avatar tim-salabim commented on July 24, 2024

@timelyportfolio any news on the issue of making the map element fit the available space in the paneViewer?

from mapedit.

timelyportfolio avatar timelyportfolio commented on July 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.