[geotk] ISO 19115-2 support

David Neufeld David.Neufeld at noaa.gov
Tue Dec 8 16:42:45 EST 2009


Hi All,

We've just started exploring geotoolkit for marshalling and 
unmarshalling ISO XML, and are excited about geotookit's object model 
supporting ISO 19115.

We are also interested in the ISO 19115-2 support, and would like to 
generate ISO 19115-2 from a NetCDF file.

In the example below - marshallMetadataInstrument(), we can populate an 
instrument object using setter methods and then marshal it to ISO 19115 
XML which returns:

<gmd:MI_Instrument ...>
...
</gmd:MI_Instrument>

But it's not clear how to generate ISO 19115-2 XML from a populated 
DefaultInstrument object using the SpatialMetadata class (or whether 
this is the wrong approach entirely).

          SpatialMetadataFormat stream = SpatialMetadataFormat.STREAM;
          SpatialMetadata spatialMeta = new SpatialMetadata(stream);    
     
          Instrument instrument = 
spatialMeta.getInstanceForType(Instrument.class);
          defInstrument = new DefaultInstrument(instrument); 
//IllegalArgumentException: No such element: Citations

Any suggestions are greatly appreciated...

Thanks, Dave

    public void marshallMetadataInstrument() {

        DefaultInstrument defInstrument;
        DefaultCitation defCitation;
        DefaultIdentifier defIdentifier;
      
        defInstrument = new DefaultInstrument();             
        defCitation = new DefaultCitation();
        defIdentifier = new DefaultIdentifier();                

        //Setters
        List<Citation> citationList = new ArrayList<Citation>();
        citationList.add(defCitation);             
         
        defIdentifier.setCode("ASCAT > Advanced Scatterometer");
        defInstrument.setIdentifier(defIdentifier);

        SimpleInternationalString intStrType = new 
SimpleInternationalString("scatterometer");
        defInstrument.setType(intStrType);
        defInstrument.setCitations(citationList);
             
        SimpleInternationalString intStrDesc = new 
SimpleInternationalString("Instrument Type: scatterometer, Operational 
Mode: , Collection Type: radar.");
        defInstrument.setDescription(intStrDesc);           
       
 
        File tf = new File("C:/temp/geotkiso-instrument.xml");
        try {
          XML.marshal(defInstrument, tf); 
        } catch (Exception e) {
          e.printStackTrace();
        }               
    }

David Neufeld
Enterprise Data Systems Group
NOAA, NGDC, CIRES
(303) 497-6507
David.Neufeld at noaa.gov


More information about the Geotoolkit mailing list