我计划使用 Leaflet、Shiny 和 Shinydashboard 沿着以下很棒的路线创建一个带有医院 OHS 事件标记的交互式地图交互式地图和直方图模板 http://shiny.rstudio.com/gallery/superzip-example.html
我的问题是我没有坐标参考系统,因为这不是地理对象(没有纬度和经度)。它也是光栅形式。
How can I make the below floorplan into something with a CRS (coordinate reference system) that can be treated like a map.
也就是说,我希望能够平移、缩放、添加标记等。
似乎有一种方法可以使用 Java 来做到这一点,但我希望在 R 中做到这一点,因为我不熟悉 Java。看空间地图坐标 http://leafletjs.com/examples/crs-simple/crs-simple.html
这是一个使用的解决方案mapview:
library(raster)
library(png)
library(mapview)
web_img <- "https://i.stack.imgur.com/8aSe9.png"
png <- readPNG(readBin(web_img, "raw", 1e6))
rst_blue <- raster(png[, , 1])
rst_green <- raster(png[, , 2])
rst_red <- raster(png[, , 3])
img <- brick(rst_red, rst_green, rst_blue)
m <- viewRGB(img)
m@map %>% addMarkers(lng = 0.5, lat = 0.5)
请注意,坐标的原点位于图像的左下角 (0, 0),在本例中,缩放到右下角的 (0, 1) 和右上角的 (0.859, 1),以保持长宽比正确。在这个局部坐标参考系中添加标记应该很容易。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)