Warning This is a very draft version. New here? See "how to set up an IDE to develop SNAP extensions" You can put any number of readers in a modules. Create new module? See "how to create and configure a SNAP extension module" Product readers are snap-engine services. Add unit-level tests in Example: Create resource directory Add file named Edit file, for each product reader add its fully qualified class name on a single line (no spaces, no word wrapping): If you don't need any special GUI for your reader other than import actions and / or some help pages, then we don't need writing any Java code. Instead we have to add some NetBeans-specific configuration files to the module. Detailed information on NetBeans module development is given here: First step is to create a resources package e.g. Add file Most of your module's metadata is derived from your project's Maven Create source directory Add file Here is a comprehensive list of all allowed NetBeans "manifest headers": http://bits.netbeans.org/8.0/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html#how-manifest Warning: lines in this file must not exceed 72 characters. If so, introduce an LF and start new line with a single space character. snap-geotiff snap-hdf5 ...Engine Integration
Java code
org.esa.snap.dataio.<format-name>
<FormatName>ProductReaderPlugIn
implementing org.esa.snap.core.dataio.ProductReaderPlugIn
interface<FormatName>ProductReader
extending org.esa.snap.core.dataio.AbstractProductReader
classConsider following advices:
AbstractProductReader
readBandRasterDataImpl(...)
close()
and clean up resource acquired. Especially close input streams.src/test/java
.Add RGB-Profiles
public class SpotVgtProductReaderPlugIn implements ProductReaderPlugIn {
public SpotVgtProductReaderPlugIn() {
RGBImageProfileManager manager = RGBImageProfileManager.getInstance();
manager.addProfile(new RGBImageProfile("SPOT VGT RGB-1", new String[] {"MIR", "0.5 * (B2 + B3)", "B0 + 0.1 * MIR"}));
manager.addProfile(new RGBImageProfile("SPOT VGT RGB-2", new String[] {"B3", "0.5 * (B2 + B3)", "B0 + 0.1 * B3"}));
}
...
Service registration
META-INF/services
in src/resources
org.esa.snap.core.dataio.ProductReaderPlugIn
org.esa.snap.dataio.<format-name>.<FormatName>ProductReaderPlugIn
Desktop GUI Integration
org.esa.snap.dataio.<format-name>
in src/resources
layer.xml
with following content:<filesystem>
<!-- Define action in Actions/Readers/ -->
<folder name="Actions">
<folder name="Readers">
<file name="org-esa-snap-dataio-spot-Import[Format]Product.instance">
<attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
<attr name="delegate" methodvalue="org.esa.snap.rcp.actions.file.ImportProductAction.create"/>
<attr name="displayName" stringvalue="[Format-DisplayName]"/>
<attr name="formatName" stringvalue="[Format-Name]"/>
<attr name="useAllFileFilter" boolvalue="true"/>
<attr name="helpId" stringvalue="import[Format]Product"/>
</file>
</folder>
</folder>
<!-- Place action into menu File/Import/Optical Sensors/[Format] -->
<folder name="Menu">
<folder name="File">
<folder name="Import">
<folder name="Optical Sensors">
<file name="org-esa-snap-dataio-spot-Import[Format]Product.shadow">
<attr name="originalFile"
stringvalue="Actions/Readers/org-esa-snap-dataio-spot-Import[Format]Product.instance"/>
</file>
</folder>
</folder>
</folder>
</folder>
</filesystem>
Add extra module metadata
pom.xml
file. However, some so called module "manifest-headers" cannot be derived from it (e.g. the location of the layer.xml
file), so we have to provide them in a special configuration file. src/main/nbm
manifest.mf
with following content:Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true
AutoUpdate-Essential-Module: true
OpenIDE-Module-Layer: org/esa/snap/dataio/<format-name>/layer.xml
OpenIDE-Module-Java-Dependencies: Java > 1.8
OpenIDE-Module-Display-Category: SNAP
Code examples in SNAP
RGB-Profiles
org.esa.snap.core.dataio.ProductReaderPlugIn
layer.xml
manifest.mf
Manage space
Manage content
Integrations