Hi Michael,
well, I tried that too, but Raster2VEctorProcess remains unresolved.
For the moment I have a dirty hack, which works. And the resulting
vectorization is correct, so thumbs up for the code!:
ProgressListener progress = null;
Process r2v = (new Raster2VectorFactory()).create();
Map<String, Parameter<?>> r2vpinfo = (new
Raster2VectorFactory()).getParameterInfo();
Set<Entry<String, Parameter<?>>> set = r2vpinfo.entrySet();
ArrayList<Entry> entrylist = new ArrayList<Entry>();
Iterator<Entry<String, Parameter<?>>> iter = set.iterator();
while (iter.hasNext()) {
Entry<String, Parameter<?>> entry = iter.next();
entrylist.add(entry);
}
Map<String, Object> input = new HashMap<String, Object>();
input.put(entrylist.get(0).getKey().toString(), gchor);
input.put(entrylist.get(1).getKey().toString(), 0);
input.put(entrylist.get(2).getKey().toString(), -1d);
// instead of:
// input.put(RasterToVectorFactory.BAND.key, band);
// input.put(RasterToVectorFactory.OUTSIDE.key,
outsideValues);
//
//FeatureCollection result =
Map<String, Object> result = r2v.execute(input, progress);
Iterator<Entry<String, Object>> iterresult =
result.entrySet().iterator();
ArrayList<Entry> resultentrylist = new ArrayList<Entry>();
while (iterresult.hasNext()) {
Entry<String, Object> entry = iterresult.next();
resultentrylist.add(entry);
}
Ugly, but it works. I have no idea why Raster2VEctorProcess is
unresolved. My imports are correct, having, among others:
import org.geotools.data.Parameter;
import org.geotools.process.*;
import org.geotools.process.Process;
import org.geotools.process.raster.Raster2VectorFactory;
Thanks
Martin
Michael Bedward wrote:
> Hi Martin,
>
>
>> I am obviously missing something. What is it? Maybe it is just my lack
>> of experience with factories/parameters, but so far I have used them for
>> coverages or shapefiles and all was good.
>>
>
> Welcome to 'unsupported' land :-)
>
> I'm afraid that the unit test for the raster to vector function is not
> a good guide for general use because it goes "behind the scenes" of
> the process api. That was me being lazy.
>
>
>> It also seems like the approach used in the UserGuide:
>>
>> features = Raster2Vector.process( gridCoverage, 2, Collections.EMPTY, null );
>>
>> does not work - the method process is not offered for Raster2Vector.
>>
>
> That example has a typo. It should be...
> features = Raster2VectorProcess.process(coverage, band, outsideValues, null);
>
> Hope this helps
>
> Michael
>
>
>
--
Martin Tomko
Postdoctoral Research Assistant
Geographic Information Systems Division
Department of Geography
University of Zurich - Irchel
Winterthurerstr. 190
CH-8057 Zurich, Switzerland
email: [email protected]
site: http://www.geo.uzh.ch/~mtomko
mob: +41-788 629 558
tel: +41-44-6355256
fax: +41-44-6356848
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users