Skip to content

Commit

Permalink
#153 MI_Georeferenceable -> ISOImageryGeoreferenceable, MI_Georectifi…
Browse files Browse the repository at this point in the history
…ed -> ISOImageryGeorectified
  • Loading branch information
eblondel committed Jun 10, 2019
1 parent 98061e3 commit 8215883
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ export(ISOImageryEvent)
export(ISOImageryGCP)
export(ISOImageryGCPCollection)
export(ISOImageryGeometryType)
export(ISOImageryGeorectified)
export(ISOImageryGeoreferencerable)
export(ISOImageryImageDescription)
export(ISOImageryInstrument)
export(ISOImageryMetadata)
Expand Down
70 changes: 70 additions & 0 deletions R/ISOImageryGeorectified.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#' ISOImageryGeorectified
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords ISO image georectified
#' @return Object of \code{\link{R6Class}} for modelling an ISO image Georectified
#' @format \code{\link{R6Class}} object.
#'
#' @field checkPoint [\code{list} of \code{\link{ISOImageryGCP}}]
#'
#' @section Methods:
#' \describe{
#' \item{\code{new(xml,value)}}{
#' This method is used to instantiate an \code{\link{ISOImageryGeorectified}}
#' }
#' \item{\code{addCheckPoint(sfg,m)}}{
#' Adds a check point, either an object of class 'sfg' (from \pkg{sf}) or a 'matrix'
#' }
#' \item{\code{delCheckPoint(sfg,m)}}{
#' Deletes a check point, either an object of class 'sfg' (from \pkg{sf}) or a 'matrix'
#' }
#' }
#'
#' @section Methods inherited from \code{\link{ISOGridSpatialRepresentation}}:
#' \describe{
#' See \code{\link{ISOGridSpatialRepresentation}}
#' }
#'
#' @section Methods inherited from \code{\link{ISOGeorectified}}:
#' \describe{
#' See \code{\link{ISOGeorectified}}
#' }
#'
#' @references
#' ISO 19115-2:2009 - Geographic information -- Metadata -- Part 2: Extensions for imagery and gridded data
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOImageryGeorectified <- R6Class("ISOImageGeorectified",
inherit = ISOGeorectified,
private = list(
xmlElement = "MI_Georectified",
xmlNamespacePrefix = "GMI"
),
public = list(

#checkPoint [0..*]: ISOImageryGCP
checkPoint = list(),

initialize = function(xml = NULL){
super$initialize(xml = xml)
},

#addCheckPoint
addcheckPoint = function(sfg = NULL, m = NULL){
checkPoint <- ISOImageryGCP$new()
checkPoint$setGeographicCoordinates(sfg = sfg, m = m)
return(self$addListElement("checkPoint", checkPoint))
},

#delCheckPoint
delcheckPoint = function(sfg = NULL, m = NULL){
checkPoint <- ISOImageryGCP$new()
checkPoint$setGeographicCoordinates(sfg = sfg, m = m)
return(self$delListElement("checkPoint", checkPoint))
}

)
)
72 changes: 72 additions & 0 deletions R/ISOImageryGeoreferenceable.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#' ISOImageryGeoreferencerable
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords ISO imagery Georeferencerable
#' @return Object of \code{\link{R6Class}} for modelling an ISO imagery Georeferencerable
#' @format \code{\link{R6Class}} object.
#'
#' @field geolocationInformation [\code{list} of \code{\link{ISOImageryAbstractGeolocationInformation}}]
#'
#' @section Methods:
#' \describe{
#' \item{\code{new(xml,value)}}{
#' This method is used to instantiate an \code{\link{ISOImageryGeoreferencerable}}
#' }
#' \item{\code{addGeolocationInformation(geolocationInformation)}}{
#' Adds a geolocation information, an object of class \code{\link{ISOImageryAbstractGeolocationInformation}}
#' }
#' \item{\code{delGeolocationInformation(geolocationInformation)}}{
#' Deletes geolocation information, an object of class \code{\link{ISOImageryAbstractGeolocationInformation}}
#' }
#' }
#'
#' @section Methods inherited from \code{\link{ISOGridSpatialRepresentation}}:
#' \describe{
#' See \code{\link{ISOGridSpatialRepresentation}}
#' }
#'
#' @section Methods inherited from \code{\link{ISOGeoreferenceable}}:
#' \describe{
#' See \code{\link{ISOGeoreferenceable}}
#' }
#'
#' @references
#' ISO 19115-2:2009 - Geographic information -- Metadata -- Part 2: Extensions for imagery and gridded data
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOImageryGeoreferencerable <- R6Class("ISOImageryGeoreferencerable",
inherit = ISOGeoreferencerable,
private = list(
xmlElement = "MI_Georeferenceable",
xmlNamespacePrefix = "GMI"
),
public = list(

#geolocationInformation [0..*]: ISOImageryGeolocationInformation
geolocationInformation = list(),

initialize = function(xml = NULL){
super$initialize(xml = xml)
},

#addGeolocationInformation
addGeolocationInformation = function(geolocationInfo){
if(!inherits(geolocationInfo, "ISOImageryAbstractGeolocationInformation")){
stop("The argument should be an object inheriting 'ISOImageryAbstractGeolocationInformation")
}
return(self$addListElement("geolocationInformation", geolocationInfo))
},

#delGeolocationInformation
delGeolocationInformation = function(geolocationInfo){
if(!inherits(geolocationInfo, "ISOImageryAbstractGeolocationInformation")){
stop("The argument should be an object inheriting 'ISOImageryAbstractGeolocationInformation")
}
return(self$delListElement("geolocationInformation", geolocationInfo))
}

)
)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ We thank in advance people that use ``geometa`` for citing it in their work / pu
|:------------------------------------|:-----------------------------------------------------------------------------------|:---------|:-------------------------------------------------------------------------------------------------------------------------------|---------:|-------:|
|ISO/TC211 19110:2005 |Geographic Information - Methodology for feature cataloguing |GFC |[![ISO/TC211 19110:2005](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa) | 17| 0|
|ISO/TC211 19115-1:2003 |Geographic Information - Metadata |GMD |[![ISO/TC211 19115-1:2003](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa) | 132| 0|
|ISO/TC211 19115-2:2009 |Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data |GMI |[![ISO/TC211 19115-2:2009](https://img.shields.io/badge/-85%25-33cc7a.svg)](https://github.com/eblondel/geometa) | 34| 6|
|ISO/TC211 19115-2:2009 |Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data |GMI |[![ISO/TC211 19115-2:2009](https://img.shields.io/badge/-90%25-33cc7a.svg)](https://github.com/eblondel/geometa) | 36| 4|
|ISO/TC211 19119:2005 |Geographic Information - Service Metadata |SRV |[![ISO/TC211 19119:2005](https://img.shields.io/badge/-37%25-ff0c0c.svg)](https://github.com/eblondel/geometa) | 7| 12|
|ISO/TC211 19139:2007 |Geographic Metadata XML Schema |GMX |[![ISO/TC211 19139:2007](https://img.shields.io/badge/-8%25-ad0f0f.svg)](https://github.com/eblondel/geometa) | 5| 61|
|ISO/TS 19103:2005 |Geographic Common extensible markup language |GCO |[![ISO/TS 19103:2005](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa) | 22| 0|
Expand Down
4 changes: 2 additions & 2 deletions inst/extdata/coverage/geometa_coverage_inventory.csv
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI","MI_GCP","ISOImageryGCP",TRUE
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI","MI_GCPCollection","ISOImageryGCPCollection",TRUE
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI","MI_GeometryTypeCode","ISOImageryGeometryType",TRUE
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI","MI_Georectified","<missing>",FALSE
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI","MI_Georeferenceable","<missing>",FALSE
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI","MI_Georectified","ISOImageryGeorectified",TRUE
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI","MI_Georeferenceable","ISOImageryGeoreferencerable",TRUE
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI","MI_ImageDescription","ISOImageryImageDescription",TRUE
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI","MI_Instrument","ISOImageryInstrument",TRUE
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI","MI_Metadata","ISOImageryMetadata",TRUE
Expand Down
2 changes: 1 addition & 1 deletion inst/extdata/coverage/geometa_coverage_summary.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"Standard","Title","Namespace","Supported","Missing","Coverage"
"ISO/TC211 19110:2005","Geographic Information - Methodology for feature cataloguing","GFC",17,0,100
"ISO/TC211 19115-1:2003","Geographic Information - Metadata","GMD",132,0,100
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI",34,6,85
"ISO/TC211 19115-2:2009","Geographic Information - Metadata - Part 2: Extensions for imagery and gridded data","GMI",36,4,90
"ISO/TC211 19119:2005","Geographic Information - Service Metadata","SRV",7,12,36.84
"ISO/TC211 19139:2007","Geographic Metadata XML Schema","GMX",5,61,7.58
"ISO/TS 19103:2005","Geographic Common extensible markup language","GCO",22,0,100
Expand Down
60 changes: 60 additions & 0 deletions man/ISOImageryGeorectified.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions man/ISOImageryGeoreferencerable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions tests/testthat/test_ISOImageryGeorectified.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# test_ISOImageryGeorecrified.R
# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
#
# Description: Unit tests for ISOImageryGeorecrified.R
#=======================
require(geometa, quietly = TRUE)
require(sf, quietly = TRUE)
require(testthat)

context("ISOImageryGeorecrified")

test_that("encoding",{
testthat::skip_on_cran()
testthat::skip_on_travis()
#encoding
md <- ISOImageryGeorecrified$new()
md$setNumberOfDimensions(1)
md$setTransformationParameterAvailability(FALSE)
dim1 <- ISODimension$new()
dim1$setName("row")
dim1$setSize(100)
dim1$setResolution(ISOMeasure$new(value=1,uom="m"))
md$addDimension(dim1)
md$setCellGeometry("area")

md$setCheckPointAvailability(TRUE)
md$setCheckPointDescription("string")
pt <- st_point(c(1,1))
md$setCenterPoint(sfg = pt)
md$setPixelOrientation("center")

md$addCheckPoint(sfg = st_point(c(0,0)))
md$addCheckPoint(sfg = st_point(c(1,1)))

xml <- md$encode()
expect_is(xml, "XMLInternalNode")

#decoding
md2 <- ISOImageryGeorecrified$new(xml = xml)
xml2 <- md2$encode()

expect_true(ISOAbstractObject$compare(md, md2))
})
Loading

0 comments on commit 8215883

Please sign in to comment.