Thank you once again! We can mark this thread as "solved" :)
Jiri On 07/27/2011 02:39 AM, Michael Bedward wrote: > Hi Jiri, > > Yes, the snapshots are in a different repo to the formal releases. See > here for details: > http://docs.geotools.org/latest/userguide/faq.html#q-what-is-a-snapshot-version-and-how-do-i-use-it > > Enjoy :) > > Michael > > > On 27 July 2011 15:36, Jiří Novák<[email protected]> wrote: >> Thank you very much Michael, that's exactly what I needed, now can I >> continue coding :-)! >> >> Just a last question, what is the correct version to obtain daily snapshots >> you mentioned? >> I was trying: >> <org.geotools.version>8-SNAPSHOT</org.geotools.version> >> and: >> <org.geotools.version>8.0-SNAPSHOT</org.geotools.version> >> >> ...but none of them worked for me. >> >> Do I have just wrong specified version or do I need different repository? >> <repository> >> <id>OSGEO GeoTools repo</id> >> <url>http://download.osgeo.org/webdav/geotools</url> >> </repository> >> >> >> Regards, >> Jiri >> >> On 07/27/2011 02:16 AM, Michael Bedward wrote: >>> Hi Jiri, >>> >>> You are using the most recent milestone release rather than the >>> snapshot (daily) version. That explains the spurious logging messages >>> which were fixed more recently. The vectorizing code hasn't changed >>> since the milestone release so you're not missing anything there. >>> >>> You won't need to union polygons, dissolve boundaries etc with the >>> polygons returned by RasterToVectorProcess. Since they are derived >>> from raster regions there will be no covering intersections or >>> adjacent polys with the same value. >>> >>> To gather the individual polygons from the feature collection and >>> create a MultiPolygon... >>> >>> SimpleFeatureIterator featureIter = fc.features(); >>> List<Polygon> polyList = new ArrayList<Polygon>(); >>> try { >>> while (featureIter.hasNext()) { >>> polyList.add((Polygon) >>> featureIter.next().getDefaultGeometry()); >>> } >>> } finally { >>> featureIter.close(); >>> } >>> >>> GeometryFactory gf = new GeometryFactory(); >>> MultiPolygon mp = gf.createMultiPolygon(polyList.toArray(new >>> Polygon[0])); >>> >>> If your input image has a value that you want to treat as outside / >>> nodata, you can specify this using the outsideValues arg of the >>> RasterToVectorProcess.process method to avoid creating polygons for >>> nodata regions. Alternatively you can just vectorize everything and >>> test the value of the "gridvalue" attribute in the feature collection. >>> For example... >>> >>> while (featureIter.hasNext()) { >>> SimpleFeature feature = featureIter.next(); >>> // skip polygons for outside value 0 >>> if (((Number) >>> feature.getAttribute("gridvalue")).intValue() == 0) { >>> polyList.add((Polygon) feature.getDefaultGeometry()); >>> } >>> } >>> >>> You could also something similar if you have a number of different >>> grid values and want to create a separate MultiPolygon for each. >>> >>> Michael >>> >>> On 27 July 2011 12:25, Jiří Novák<[email protected]> wrote: >>>> Hi Michael, >>>> >>>> thanks for leading me :) >>>> >>>> Also answering inlines... >>>> >>>> On 07/26/2011 11:19 PM, Michael Bedward wrote: >>>>> Hi Jiri, >>>>> >>>>> Please see my comments inline: >>>>> >>>>>> This is my code: >>>>>> >>>>>> FeatureCollection<SimpleFeatureType,SimpleFeature> >>>>>> collection >>>>>> = >>>>>> RasterToVectorProcess.process(cov, band, bounds, >>>>>> outsideValues, >>>>>> insideEdges, null); >>>>>> >>>>>> FeatureIterator<SimpleFeature> iterator = >>>>>> collection.features(); >>>>>> try { >>>>>> while( iterator.hasNext() ){ >>>>>> SimpleFeature feature = iterator.next(); >>>>>> >>>>>> System.out.println(feature.getDefaultGeometry().getClass()); >>>>>> } >>>>>> } >>>>>> finally { >>>>>> iterator.close(); >>>>>> } >>>>>> >>>>>> GeometryFactory gf = new GeometryFactory(); >>>>>> MultiPolygon mp = gf.createMultiPolygon( collection.toArray(new >>>>>> Polygon[0]) ); >>>>> Ah... I've given you a bum steer sorry. I hadn't ready your previous >>>>> email and was thinking you were using the JAITools operator with >>>>> Collection<Polygon> output. Sorry about that. >>>>> >>>>> The RasterToVectorProcess is giving you a SimpleFeatureCollection >>>>> where the Geometry type is Polygon. Do you want to convert each of >>>>> these to individual MultiPolygons or combine all of them into a single >>>>> MultiPolygon ? I just want to check so that I don't send you off in >>>>> the wrong direction again :) >>>>> >>>> I need to obtain just one MultiPolygon as the combination >>>> (dissolve/merge) >>>> of those in SimpleFeatureCollection. >>>>>> 1) many info logs about EPSG initialization - is there a way to get rid >>>>>> of >>>>>> it? E.g. set the geotools log level to warning? >>>>> Those log messages were recently changed to Level.FINE on trunk >>>>> (8.0-SNAPSHOT). Are you using the most recent binaries ? >>>>> >>>> I hope so, I am using this maven configuration: >>>> ... >>>> <!-- === Versions of used frameworks and libraries === --> >>>> <properties> >>>> ... >>>> <org.geotools.version>8.0-M1</org.geotools.version> >>>> ... >>>> </properties> >>>> >>>> <repositories> >>>> <repository> >>>> <id>OSGEO GeoTools repo</id> >>>> <url>http://download.osgeo.org/webdav/geotools</url> >>>> </repository> >>>> ... >>>> </repositories> >>>> >>>> Is the right repository for the latest artifacts? >>>> >>>> Jiri >>>>>> 3) And then it falls at line: "MultiPolygon mp = gf.createMultiPolygon( >>>>>> collection.toArray(new Polygon[0]) );" raising exception of incorrect >>>>>> storing (allthought the types seems to correspond). >>>>> That's because I told you to do the wrong thing. >>>>> >>>>> Michael >> ------------------------------------------------------------------------------ Got Input? Slashdot Needs You. Take our quick survey online. Come on, we don't ask for help often. Plus, you'll get a chance to win $100 to spend on ThinkGeek. http://p.sf.net/sfu/slashdot-survey _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
