I'm trying to create an interactive plot with leaflet containing polygons. The coordinates of these polygons are not longitude/latitudes but rather Cartesian x and y coordinates that represent a building floor plan.
For coordinates that are single digit numbers the results look good:
library(leaflet)
library(sp)
Sr1 = Polygon(cbind(c(9, 8, 8, 9, 9),
c(3, 3, 4, 4, 3)))
Srs1 = Polygons(list(Sr1), "s1")
SpP = SpatialPolygons(list(Srs1), 1L)
leaflet() %>% addPolygons(data = SpP)
But when I increase all y coordinates by 100 things go wrong:
library(leaflet)
library(sp)
Sr1 = Polygon(cbind(c(9, 8, 8, 9, 9),
c(103, 103, 104, 104, 103)))
Srs1 = Polygons(list(Sr1), "s1")
SpP = SpatialPolygons(list(Srs1), 1L)
leaflet() %>% addPolygons(data = SpP)
I'm guessing this has to do with the default projection settings of the map. I tried initializing the map with these settings:
leaflet(options(crsClass = "L.CRS.Simple"))
After reading this example but with no success.