0

I have 3 shapefiles:

  1. mapa - All national roads from Bahia, Brazil (lines)
  2. postos - All Police Stations on those roads (points)
  3. 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')

SymbolixAU
  • 25,502
  • 4
  • 67
  • 139
  • It's very difficult to help without having your data or at least seeing some of it. Could you perhaps provide the range of Latitude and Longitude values for each `Mes` and each shape? Perhaps there is no data for one of those... – sebdalgarno Apr 19 '18 at 17:04
  • Later on, when i get home, i'll put some prints of the objects. But, be sure there ir data for **Mês**. It means **month**, and every month there is lots of accidents. The longitudo is ok, otherwise, the first plot would give error too. – danilo ribeiro de abreu Apr 19 '18 at 18:00
  • Do you know the CRS (Coordinate Reference System) of your shapefiles? They might be in a different CRS which doesn't use latitude-longitude, with Y values outside the [-90,90] range. – IvanSanchez Apr 19 '18 at 22:49

0 Answers0