r-spatial / rgee

Google Earth Engine for R
https://r-spatial.github.io/rgee/
Other
677 stars 146 forks source link

Question - rgee inspector tool functionality available? #217

Closed zackarno closed 1 year ago

zackarno commented 2 years ago

Hello,

I was wondering if rgee has functionality to use an inspector tool on map visualizations (similar to the Javascript code editor)? If not, is there a known work-around or is this a feasible enhancement/feature request?

csaybar commented 2 years ago

This would be a very useful feature, however, I haven't had the time to implement it. In order to minimize dependencies on rgee, I think this would fit better in another R package (maybe eeProfiler?). We don't need to start from scratch, since much of the mapedit code could be reused.

I'm going to leave this issue open in case someone is interested in implementing it.

zackarno commented 2 years ago

@csaybar & @ambarja - was looking into this possibility. I saw that @ambarja had started the rgeeInspector (nice!) .

I opened an issue/question on the leaflet github repo to see if it was possibly to extract the input data object from a leaflet map object (like that created by rgee::Map$addLayer()). It seems like it may not be possible because it doesn't seem like leaflet stores the input object inside the map object - however {mapview} does store it in an @object slot. I was thinking if we could access the data layer object(s) from the map it would be easy to implement the GEE inspect functionality with rgeeInspector just by passing the map object... something like:

m1 <- map$addLayer(...)

# this would open mapedit, allowing you to draw geom(s), after clicking done it would return a new leaflet map with the points labeled with layer values
m1 |> inspect() 

on the issue @tim-salabim had some helpful suggestions : https://github.com/rstudio/leaflet/issues/813#issuecomment-1210512755 .