geometa icon indicating copy to clipboard operation
geometa copied to clipboard

Trying to convert an EML to ISO: Error in as(f, "ISOMetadata"): no method or default for coercing “character” to “ISOMetadata”

Open yvanlebras opened this issue 1 year ago • 2 comments

Hi Emmanuel,

I am trying things ;) And notably to convert an EML metadata file into ISOMetadata object so I can look at the ISO19139 resulting metadata file.

Trying with this code (my original EML metadata document PATH is in "file_path" variable):

install.packages("devtools")
devtools::install_github("ropensci/emld")
f <- system.file(file_path, package="emld")
library("geometa")
my_geometa_object <- as(f, "ISOMetadata")

I have an error message:

Error in as(f, "ISOMetadata"): no method or default for coercing “character” to “ISOMetadata”
Traceback:

1. as(f, "ISOMetadata")
2. stop(gettextf("no method or default for coercing %s to %s", dQuote(thisClass), 
 .     dQuote(Class)), domain = NA)

For sure I made something wrong, sorry if really stupid....

Wishing you a very good end of week,

Cheers

yvanlebras avatar Jun 19 '24 21:06 yvanlebras

You can look at https://github.com/eblondel/geometa/blob/master/tests/testthat/test_geometa_mapping.R#L311

Here used it directly on a file f, you should first read the file as emld object, after that you can convert it to ISOMetadata. This said, this mapping stuff was highly experimental, although it was working at that time, I didn't try since a loooong time..

eblondel avatar Jun 19 '24 22:06 eblondel

Oh, sorry, really stupid ;) My EML is not an emld object...

yvanlebras avatar Jun 19 '24 22:06 yvanlebras