-
Notifications
You must be signed in to change notification settings - Fork 32
Closed
Description
Would it be possible to support maps which are not in the standard projection? Specifically I would like to use addGlPoints with a map created using L.CRS.Simple. My base map is a microscope image of a tissue section; I would like to draw points representing hundreds of thousands of cells as a layer on top. It works (slowly) to use leaflet::addCircles with coordinates in the range 0-255; this fails with leafgl::addGlPoints because it tries to convert the points to EPSG:4326.
Example with no base map:
library(leaflet)
library(leafgl)
library(magrittr)
n=1000
pts = data.frame(id = 1:n,
x = rnorm(n, 128, 30),
y = rnorm(n, -128, 18))
crs <- leafletCRS(crsClass = "L.CRS.Simple")
map = leaflet(options = leafletOptions(crs = crs)) %>%
setView(128, -128, 1)
# Works
map %>% addCircles(data=pts, lat=~y, lng=~x)
# Doesn't work
map %>% addGlPoints(st_as_sf(pts, coords=c('x', 'y')))
#Error in st_transform.sfc(st_geometry(x), crs, ...) :
# sfc object should have crs set
#Calls: %>% ... st_transform.sf -> st_transform -> st_transform.sfc
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels