...
- First of all, you need IDL installed on your machine. Make sure to define an IDL_HOME environment variable referring to your IDL folder installation.
- When done, make sure the "%IDL_HOME%\bin\bin.x86" folder is on your Java Library Path.
- Create your IDL algorithm .pro definition file on "%IDL_HOME%\lib folder".
- Use the IDL Bridge Export Assistant to produce the Wrapping Java class from that definition file.
- SetUp your Geotools Process and factories leveraging on the newly created wrapper.
Sample code
| Code Block |
|---|
package org.geotools.process.idl.impl;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import org.geotools.process.Process;
import org.geotools.process.ProcessException;
import org.geotools.test.TestData;
import org.junit.Assert;
/**
* Simple test class leveraging on the Feature Extraction function, offered by
* means of the proper IDL wrapper.
*/
public class IDLProcessTest{
public void testFeatureExtractionProcess() throws InterruptedException,
FileNotFoundException, IOException, ProcessException {
final IDLFeatureExtractionProcessFactory factory = new IDLFeatureExtractionProcessFactory();
final Process process = factory.create();
File testData = TestData.file(this, "testin.tif");
final Map<String, Object> values = new LinkedHashMap<String, Object>(2);
values.put("input_data", testData.getAbsolutePath());
Map<String, Object> result = null;
result = process.execute(values, null);
if (result != null && !result.isEmpty()) {
final Iterator<String> keysIt = result.keySet().iterator();
final Object output = result.get(keysIt.next());
Assert.assertNotNull(output);
}
}
}
|