Skip to content

Commit

Permalink
#185 fix GMLEnvelope, GMLEnvelopeWithTimePeriod
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Feb 14, 2022
1 parent f3bdb3a commit a910688
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions R/GMLEnvelope.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ GMLEnvelope <- R6Class("GMLEnvelope",
#backward compatibility in case of GML < 3
children <- xmlChildren(xml)
children <- children[names(children)=="pos"]
self$lowerCorner <- t(as.matrix(as.numeric(unlist(strsplit(xmlValue(children[[1]]), " ")))))
self$upperCorner <- t(as.matrix(as.numeric(unlist(strsplit(xmlValue(children[[2]]), " ")))))
if(length(children)>0){
self$lowerCorner <- t(as.matrix(as.numeric(unlist(strsplit(xmlValue(children[[1]]), " ")))))
self$upperCorner <- t(as.matrix(as.numeric(unlist(strsplit(xmlValue(children[[2]]), " ")))))
}
}
)
)
6 changes: 4 additions & 2 deletions R/GMLEnvelopeWithTimePeriod.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ GMLEnvelopeWithTimePeriod <- R6Class("GMLEnvelopeWithTimePeriod",
#backward compatibility in case of GML < 3
children <- xmlChildren(xml)
children <- children[names(children)=="timePosition"]
self$beginPosition <- as.POSIXct(strptime(unlist(strsplit(xmlValue(children[[1]]), " ")), "%Y-%m-%dT%H:%M:%S"), tz = "")
self$endPosition <- as.POSIXct(strptime(unlist(strsplit(xmlValue(children[[2]]), " ")), "%Y-%m-%dT%H:%M:%S"), tz = "")
if(length(children)>0){
self$beginPosition <- as.POSIXct(strptime(unlist(strsplit(xmlValue(children[[1]]), " ")), "%Y-%m-%dT%H:%M:%S"), tz = "")
self$endPosition <- as.POSIXct(strptime(unlist(strsplit(xmlValue(children[[2]]), " ")), "%Y-%m-%dT%H:%M:%S"), tz = "")
}
},

#setBeginPosition
Expand Down

0 comments on commit a910688

Please sign in to comment.