1

I am wondering if there is a way to add an icon symbol to the R code I am using to export data in GPX format.

In the navigation program I import the GPX file into all of the of coordinates are shown with an icon like a blue circle or an X. Right now I have to manually go into the program and make all of the coordinates icons and I would like to know if I can automate it within R. Maybe with pch= something for a symbol shape and col= something for a color.

Here is some example data:

 dput(head(location_information))
structure(list(Stratum = c(9, 9, 10, 10, 10, 10), Long = c(-74.7481648257133, 
-74.8131391902885, -74.8808092556099, -74.8653903776827, -74.7982608783084, 
-74.7124840980305), Lat = c(37.4333074571158, 37.2589604507964, 
37.0344661189436, 37.1094779835421, 36.9472164951635, 37.5385694318501
), Station = structure(c(449L, 450L, 1L, 2L, 3L, 4L), .Label = c("10001", 
"10002", "10003", "10004", "10005", "11001", "11002", "11003", 
"11004", "11005", "11006", "11007", "12001", "12002", "12003", 
"12004", "12005", "12006", "13001", "13002", "13003", "13004", 
"13005", "13006", "13007", "13008", "13009", "13010", "13011", 
"14001", "14002", "14003", "14004", "14005", "14006", "15001", 
"15002", "15003", "15004", "15005", "15006", "15007", "15008", 
"15009", "15010", "15011", "15012", "15013", "15014", "15015", 
"15016", "15017", "15018", "15019", "15020", "15021", "15022", 
"15023", "16001", "16002", "16003", "16004", "16005", "17001", 
"17002", "17003", "17004", "17005", "17006", "17007", "17008", 
"17009", "18001", "18002", "18003", "18004", "18005", "18006", 
"18007", "18008", "18009", "18010", "18011", "18012", "18013", 
"18014", "18015", "18016", "18017", "18018", "18019", "18020", 
"18021", "18022", "18023", "18024", "18025", "18026", "18027", 
"18028", "18029", "18030", "18031", "18032", "18033", "18034", 
"18035", "18036", "18037", "18038", "18039", "18040", "18041", 
"19001", "19002", "19003", "19004", "19005", "19006", "19007", 
"19008", "19009", "19010", "19011", "19012", "19013", "19014", 
"19015", "19016", "19017", "19018", "19019", "19020", "19021", 
"19022", "19023", "20001", "20002", "21001", "21002", "21003", 
"21004", "21005", "21006", "21007", "21008", "21009", "21010", 
"21011", "21012", "21013", "21014", "21015", "21016", "21017", 
"21018", "21019", "21020", "21021", "22001", "22002", "22003", 
"22004", "22005", "22006", "22007", "22008", "22009", "22010", 
"22011", "22012", "22013", "22014", "22015", "22016", "22017", 
"22018", "22019", "22020", "22021", "22022", "22023", "22024", 
"22025", "22026", "22027", "22028", "23001", "23002", "23003", 
"23004", "23005", "23006", "23007", "23008", "23009", "23010", 
"23011", "23012", "23013", "23014", "23015", "23016", "23017", 
"23018", "23019", "23020", "23021", "23022", "23023", "23024", 
"23025", "23026", "23027", "23028", "23029", "23030", "23031", 
"23032", "23033", "23034", "23035", "23036", "23037", "23038", 
"23039", "23040", "23041", "23042", "23043", "23044", "23045", 
"23046", "23047", "23048", "23049", "23050", "23051", "23052", 
"23053", "23054", "23055", "23056", "23057", "23058", "23059", 
"23060", "23061", "23062", "23063", "23064", "23065", "23066", 
"23067", "23068", "23069", "23070", "23071", "23072", "23073", 
"23074", "23075", "23076", "23077", "23078", "23079", "23080", 
"23081", "23082", "23083", "23084", "23085", "23086", "23087", 
"23088", "23089", "23090", "23091", "23092", "23093", "23094", 
"23095", "23096", "23097", "23098", "23099", "23100", "23101", 
"23102", "23103", "24001", "24002", "24003", "24004", "24005", 
"24006", "24007", "24008", "24009", "25001", "25002", "25003", 
"25004", "25005", "25006", "25007", "25008", "25009", "25010", 
"25011", "25012", "25013", "26001", "26002", "26003", "26004", 
"26005", "27001", "27002", "27003", "27004", "27005", "27006", 
"27007", "27008", "27009", "27010", "27011", "27012", "27013", 
"27014", "27015", "27016", "27017", "27018", "27019", "28001", 
"28002", "28003", "29001", "29002", "29003", "29004", "29005", 
"29006", "29007", "29008", "29009", "29010", "29011", "29012", 
"29013", "29014", "29015", "29016", "29017", "29018", "29019", 
"29020", "29021", "29022", "29023", "29024", "30001", "30002", 
"30003", "30004", "30005", "30006", "30007", "30008", "30009", 
"30010", "30011", "30012", "30013", "30014", "30015", "30016", 
"30017", "30018", "30019", "31001", "31002", "31003", "31004", 
"31005", "31006", "31007", "31008", "31009", "31010", "31011", 
"31012", "31013", "31014", "31015", "31016", "31017", "31018", 
"31019", "31020", "31021", "31022", "31023", "31024", "31025", 
"31026", "31027", "31028", "31029", "31030", "31031", "31032", 
"31033", "31034", "31035", "31036", "33001", "33002", "33003", 
"33004", "33005", "33006", "33007", "34001", "34002", "34003", 
"34004", "34005", "35001", "35002", "35003", "35004", "35005", 
"35006", "35007", "35008", "35009", "35010", "35011", "35012", 
"35013", "37001", "37002", "37003", "38001", "38002", "9001", 
"9002"), class = "factor")), .Names = c("Stratum", "Long", "Lat", 
"Station"), row.names = c(NA, 6L), class = "data.frame")

#write location_information to GPX format for use with navigation software 
#make location_information a spatial points shapefile

#get lat/long from location_information
    xy2<-location_information[,c(2,3)]

 ll_points <- SpatialPointsDataFrame(coords=xy2,data=location_information,proj4string =CRS("+proj=longlat + ellps=WGS84"))
    class(ll_points)
    summary(ll_points)

#assign stationid labels with rosepoint nav software
ll_points2 <- spTransform(ll_points, CRS("+proj=longlat + ellps=WGS84"))

# rename Station column name for GPX formatting
ll_points2@data$name <- ll_points2@data$Station  

#Now only write the "name" field to the file
writeOGR(ll_points2["name"], driver="GPX", layer="waypoints", 
   dsn="gpxfile1.gpx", 
         dataset_options = "GPX_USE_EXTENSIONS=yes")

R version 3.2.1 (2015-06-18)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

closed as unclear what you're asking by Simbamangu, Midavalo, user30184, Kersten, PolyGeo May 4 '16 at 10:21

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    You need to clarify exactly what you mean by an "icon symbol". In R parlance, this make very little sense. – Jeffrey Evans May 3 '16 at 17:57
  • In the navigation program I import the GPX file into all of the of coordinates are shown with an icon like a blue circle or an X. Right now I have to manually go into the program and make all of the coordinates icons and I would like to know if I can automate it within R. Maybe with pch= something for a symbol shape and col= something for a color. – user41509 May 16 '16 at 12:55

Browse other questions tagged or ask your own question.