I have 3 shapefiles:
- mapa - All national roads from Bahia, Brazil (lines)
- postos - All Police Stations on those roads (points)
- tab_sf - All accidents from 2017 and 2018 on those roads (points)
I am creating a shiny app to visualize the aciddents in various points of view. I can plot the points.. all good.. but when i try to facet for year, for example, i get the error:
Error in .pointsToMatrix(p1) : latitude < -90
i've checked the points, they're ok.
Is it possible facet is changing the values of longitude?
library(tidyverse)
library(tmap)
library(sf)
library(lubridate)
library(leaflet)
This works
tm_shape(mapa) +
tm_lines(
col = 'vl_br',
legend.col.show = FALSE,
lwd = 3) +
tm_shape(postos) +
tm_bubbles(
col = 'blue',
size = .1) +
tm_shape(tab_sf) +
tm_symbols(
size = 0.1,
shape = 16,
alpha = 0.5,
jitter = .3,
col = 'red')
But this doesn't work! Why?
tm_shape(mapa) +
tm_lines(
col = 'vl_br',
legend.col.show = FALSE,
lwd = 3) +
tm_shape(postos) +
tm_bubbles(
col = 'blue',
size = .1) +
tm_shape(tab_sf) +
tm_symbols(
size = 0.1,
shape = 16,
alpha = 0.5,
jitter = .3,
col = 'red') +
tm_facets('Mês')