Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. 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.
  2. When done, make sure the "%IDL_HOME%\bin\bin.x86" folder is on your Java Library Path.
  3. Create your IDL algorithm .pro definition file on "%IDL_HOME%\lib folder".
  4. Use the IDL Bridge Export Assistant to produce the Wrapping Java class from that definition file.
  5. 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);
		}
	}
}