Tutorial : How to use OsmAnd ,a GPS Offline app, for research (Case study : Zoocorner to Dormitory)

Overview : OsmAnd application

OsmAnd , which is OpenStreetMap Automated Navigation Directions , is a map and navigation app for Android and iOS.

It uses the OpenStreetMap (OSM) map database for its primary displays, but is an independent app not endorsed by the OpenStreetMap Foundation.

Furthermore :

  • Map data can be stored on the device for offline use.
  • Using the device’s GPS capabilities, OsmAnd offers routing, with visual and voice guidance, for car, bike, and pedestrian.

All of the main functionalities work both online and offline. Here’s the major function of OsmAnd app in the below :

  1. Map
  • Carry highly detailed, fully offline maps of any region world wide on your device!
  • Display your position and orientation on the map
  • Save your most important places as Favorites
  1. Navigation
  • Works totally offline (no roaming charges when you are abroad)
  • Turn-by-turn voice guidance (recorded and synthesized voices)
  • Search for places by address, by type (e.g.: restaurant, hotel, gas station, museum), or by geographical coordinates
  1. Bicycle and pedestrian routes
  • The offline maps include foot, hiking, and bike paths, great for outdoor activities
  • Map display and navigation mode for bicycle and pedestrian
  • Optional trip recording to local GPX file or online service
  1. Open Source
  • Compact offline vector maps
  • Global maps from OpenStreetMap, available per country or region
  • Always up-to-date maps (updated once a month)

Here’s we demonstrate how to use *OsmAnd app using R!

Step 1 : Input GPS walking track from smartphone

library(XML)
library(tmap)
library(tmaptools)
lab2dorm <- read_GPX("_gpx/lab2dorm.gpx")
lab2dorm
## $tracks
## Simple feature collection with 1 feature and 12 fields
## Geometry type: MULTILINESTRING
## Dimension:     XY
## Bounding box:  xmin: 106.7227 ymin: -6.557053 xmax: 106.7274 ymax: -6.556019
## Geodetic CRS:  WGS 84
##   name  cmt desc  src link1_href link1_text link1_type link2_href link2_text
## 1 <NA> <NA> <NA> <NA>       <NA>       <NA>       <NA>       <NA>       <NA>
##   link2_type number type                       geometry
## 1       <NA>     NA <NA> MULTILINESTRING ((106.7228 ...
## 
## $track_points
## Simple feature collection with 118 features and 27 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: 106.7227 ymin: -6.557053 xmax: 106.7274 ymax: -6.556019
## Geodetic CRS:  WGS 84
## First 10 features:
##    track_fid track_seg_id track_seg_point_id   ele                time magvar
## 1          0            0                  0 202.6 2022-10-06 17:42:02     NA
## 2          0            0                  1 199.0 2022-10-06 17:42:07     NA
## 3          0            0                  2 202.7 2022-10-06 17:42:13     NA
## 4          0            0                  3 202.7 2022-10-06 17:42:18     NA
## 5          0            0                  4 202.6 2022-10-06 17:42:24     NA
## 6          0            0                  5 202.6 2022-10-06 17:42:29     NA
## 7          0            0                  6 202.7 2022-10-06 17:42:34     NA
## 8          0            0                  7 202.5 2022-10-06 17:42:40     NA
## 9          0            0                  8 202.3 2022-10-06 17:42:46     NA
## 10         0            0                  9 202.3 2022-10-06 17:42:51     NA
##    geoidheight name  cmt desc  src link1_href link1_text link1_type link2_href
## 1           NA <NA> <NA> <NA> <NA>       <NA>       <NA>       <NA>       <NA>
## 2           NA <NA> <NA> <NA> <NA>       <NA>       <NA>       <NA>       <NA>
## 3           NA <NA> <NA> <NA> <NA>       <NA>       <NA>       <NA>       <NA>
## 4           NA <NA> <NA> <NA> <NA>       <NA>       <NA>       <NA>       <NA>
## 5           NA <NA> <NA> <NA> <NA>       <NA>       <NA>       <NA>       <NA>
## 6           NA <NA> <NA> <NA> <NA>       <NA>       <NA>       <NA>       <NA>
## 7           NA <NA> <NA> <NA> <NA>       <NA>       <NA>       <NA>       <NA>
## 8           NA <NA> <NA> <NA> <NA>       <NA>       <NA>       <NA>       <NA>
## 9           NA <NA> <NA> <NA> <NA>       <NA>       <NA>       <NA>       <NA>
## 10          NA <NA> <NA> <NA> <NA>       <NA>       <NA>       <NA>       <NA>
##    link2_text link2_type  sym type  fix sat hdop vdop pdop ageofdgpsdata dgpsid
## 1        <NA>       <NA> <NA> <NA> <NA>  NA  3.8   NA   NA            NA     NA
## 2        <NA>       <NA> <NA> <NA> <NA>  NA  3.7   NA   NA            NA     NA
## 3        <NA>       <NA> <NA> <NA> <NA>  NA  3.8   NA   NA            NA     NA
## 4        <NA>       <NA> <NA> <NA> <NA>  NA  3.7   NA   NA            NA     NA
## 5        <NA>       <NA> <NA> <NA> <NA>  NA  4.0   NA   NA            NA     NA
## 6        <NA>       <NA> <NA> <NA> <NA>  NA  4.5   NA   NA            NA     NA
## 7        <NA>       <NA> <NA> <NA> <NA>  NA  5.2   NA   NA            NA     NA
## 8        <NA>       <NA> <NA> <NA> <NA>  NA  4.1   NA   NA            NA     NA
## 9        <NA>       <NA> <NA> <NA> <NA>  NA  4.8   NA   NA            NA     NA
## 10       <NA>       <NA> <NA> <NA> <NA>  NA  5.5   NA   NA            NA     NA
##    osmand_speed                   geometry
## 1           0.0 POINT (106.7228 -6.556992)
## 2           0.0 POINT (106.7228 -6.556997)
## 3           0.0 POINT (106.7228 -6.557008)
## 4           0.0 POINT (106.7228 -6.557034)
## 5           0.0 POINT (106.7228 -6.557048)
## 6           0.4 POINT (106.7228 -6.557036)
## 7           0.1 POINT (106.7228 -6.557053)
## 8           0.3 POINT (106.7227 -6.557042)
## 9           0.1 POINT (106.7227 -6.557036)
## 10          0.0 POINT (106.7227 -6.557025)

Step 2 : Catch map raster from Open Street Map (OSM)

library(OpenStreetMap)
## Warning: package 'OpenStreetMap' was built under R version 4.2.1
ipb.OSM <- read_osm(lab2dorm$tracks, ext=1.6,use.colortable=FALSE)
library(OpenStreetMap)
lab2dormmap <-  tm_shape(ipb.OSM) + tm_rgb() +
  tm_shape(lab2dorm$tracks) + tm_lines(col="blue")
lab2dormmap

Step 3 : Saving to raster using PNG engine

png("lab2dorm.png", width=1000, height=500)
  lab2dormmap + tm_layout()
  dev.off()
## png 
##   2