Hi MIchael,
nope, nothing works, still the same error:
Exception in thread "main" java.lang.NoSuchMethodError: 
org.geotools.coverage.grid.GridGeometry2D.worldToGrid(Lorg/geotools/geometry/Envelope2D;)Lorg/geotools/coverage/grid/GridEnvelope2D;
     at 
org.geotools.process.raster.RasterToVectorProcess.initialize(RasterToVectorProcess.java:416)
     at 
org.geotools.process.raster.RasterToVectorProcess.convert(RasterToVectorProcess.java:298)
     at 
org.geotools.process.raster.RasterToVectorProcess.process(RasterToVectorProcess.java:245)
     at 
ch.uzh.geo.tomko.viewshedservice.VectorizationUtils.vectorizeRaster(VectorizationUtils.java:208)

on 2.6-SNAPSHOT.

even if I try with null:

public static FeatureCollection<SimpleFeatureType, SimpleFeature> 
vectorizeRaster(GridCoverage2D viewshed){
         int band = 0;
         Set<Double> outsideValues = Collections.singleton(-1.0D);
          Envelope2D env = null;//viewshed.getEnvelope2D();
         ProgressListener progress = null;
         FeatureCollection<SimpleFeatureType, SimpleFeature> fc=null;
         try {
             fc = RasterToVectorProcess.process(viewshed, band, 
env,outsideValues, progress);
         } catch (ProcessException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }

         return fc;
     }


On 3/12/2010 11:54 PM, Michael Bedward wrote:
> Oops... no, that's not the problem Martin. I'm afraid that's just me
> complicating things for you.
>
> I've changed the type of the bounds parameter from Envelope2D to
> org.opengis.geometry.Envelope:
>
> http://jira.codehaus.org/browse/GEOT-2980
>
> The example code reflects that change.  If you are using a 2.6.2 the
> parameter type is Envelope2D.  The example code would be as below.
> Sorry for the confusion.
>
> Also, have you tried passing null for the bounds which is interpreted
> as vectorize the whole coverage ?
>
> Michael
>
>
> public class RasterToVector {
>
>      public static void main(String[] args) throws Exception {
>          new RasterToVector().demo();
>      }
>
>      private void demo() throws Exception {
>          // beware annoying difference in parameter order and meaning between
>          // Envelope2D and ReferencedEnvelope !
>          Envelope2D env = new
> ReferencedEnvelope(DefaultGeographicCRS.WGS84, 0.0, 0.0, 8.0, 8.0);
>
>          GridCoverage2D cov = createChessboardCoverage(256, 256, 32, env);
>          FeatureCollection<SimpleFeatureType, SimpleFeature>  fc =
> RasterToVectorProcess.process(cov, 0, env,
> Collections.singletonList(0.0d), null);
>
>          MapContext map = new DefaultMapContext();
>          map.setTitle("raster to vector conversion");
>          Style style = SLD.createPolygonStyle(Color.BLUE, Color.CYAN, 1.0f);
>          map.addLayer(fc, style);
>          JMapFrame.showMap(map);
>      }
>
>      private GridCoverage2D createChessboardCoverage(int imgWidth, int
> imgHeight, int squareWidth, Envelope2D env) {
>          GridCoverageFactory factory =
> CoverageFactoryFinder.getGridCoverageFactory(null);
>          GridCoverage2D cov = factory.create("chessboard",
> createChessboardImage(imgWidth, imgHeight, squareWidth), env);
>          return cov;
>      }
>
>      private RenderedImage createChessboardImage(int imgWidth, int
> imgHeight, int squareWidth) {
>          BufferedImage img = new BufferedImage(imgWidth, imgHeight,
> BufferedImage.TYPE_BYTE_BINARY);
>          WritableRaster raster = img.getRaster();
>
>          for (int y = 0; y<  imgHeight; y++) {
>              boolean oddRow = (y / squareWidth) % 2 == 1;
>              for (int x = 0; x<  imgWidth; x++) {
>                  boolean oddCol = (x / squareWidth) % 2 == 1;
>                  raster.setSample(x, y, 0, (oddCol == oddRow ? 1 : 0));
>              }
>          }
>
>          return img;
>      }
> }
>
>
>    


-- 
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


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to