0

I'm working on shortest paths and travel time matrices between points (using osrm, OpenStreetMap and rgdal) :

library(osrm)
library(cartography) 
library(OpenStreetMap)
library(rgdal)
library(sp)
library(spatial)
suisse<-readOGR("C:/Users/Firas/Desktop/myrwork","CHE_adm0") 
suisse
regnames <- getTiles(spdf = suisse, type = "osm")
regnames
par(mar=c(0,0,0,0))
plot(suisse, col = NA)
tilesLayer(regnames, add=T)
plot(suisse, add=T, pch = 20, col = 'red', cex = 2) 

when I want to plot points on the map, the result I get is like this

map

Any help would be appreciated thank in you advance

SymbolixAU
  • 25,502
  • 4
  • 67
  • 139
  • I don't understand the question, where is your point layer and what do you expect the map to look like instead of your screenshot? – chrki Dec 19 '16 at 18:07
  • with the same code, and another shapefile, I get colored points on the map, like this one ![Valid XHTML](https://rgeomatic.hypotheses.org/files/2016/02/R.png). – Firas Von Zgr Dec 22 '16 at 11:39
  • Well, if you plot a polygon you can't expect to see points...Have a look at the class of the objects after you load them with readOGR: I expect that you'll find that one is a `SpatialPointsDataFrame`, the other a `SpatialPolygonsDataFrame` – lbusett Dec 22 '16 at 17:42
  • You've added a polygon of Switzerland (variable `suisse` from the shapefile `CHE_adm0`) and coloured it red in the last step. I assume your other shapefile contains some routes and points, you didn't add those. – chrki Dec 22 '16 at 18:18

0 Answers0