I have a simple problem that I am facing while in try to plot a SpatialPolygonsDataFrame on top of Leaflet using R. My code is as below:
leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
setView(lng = -80.8858673, lat = 41.1450276, zoom = 5) %>%
addPolygons(data = SPDF, weight = 2, color = ~colorQuantile("red", SPDF$id)(id))
Where SPDF is my SpatialPolygonsDataFrame.
When I execute this code it "PLOTS NOTHING" but only the base map. I have been searching around and this question is similar but it doesn't have this issue.
In order to plot the polygons I have been following this link.
The problem seems to be simple but it has consumed allot of time for me. Looking forward for the suggestions. Thanks for the time.
NOTE: SPDF contains data exported from OSM, which means the coordinates (of POLYGONS) are without the decimal points as it is in the OSM data.