A lot of the operations are built around JAI operations, do you know if 
geomajas is installing that into the JRE, or as a pure java jar dependency?
-- 
Jody Garnett


On Tuesday, 18 September 2012 at 10:04 AM, dementiev wrote:

> Hi guys!
> We have rather strange issue while making a crop with geotools in grails
> application. 
> We want to crop tiff file by the box of vec shape feature.
> 
> Our code:
> public static GridCoverage2D crop(final String pathToTiff, final Feature
> shapeFeature, final CoordinateReferenceSystem targetCRS, final
> CoordinateReferenceSystem sourceCRS) throws IOException, FactoryException,
> TransformException {
> final File file = new File(pathToTiff);
> Geometry mp = (MultiPolygon) ((SimpleFeatureImpl)
> shapeFeature).getDefaultGeometry();
> MathTransform transformToTarget = CRS.findMathTransform(sourceCRS,
> targetCRS);
> 
> mp = JTS.transform(mp, transformToTarget);
> 
> GeoTiffFormat format = (GeoTiffFormat)
> GridFormatFinder.findFormat(file);
> GeoTiffReader reader = format.getReader(file);
> GridCoverage2D gc = reader.read(null);
> 
> Crop crop = new Crop();
> 
> ParameterValueGroup cropParameterValueGroup = crop.getParameters();
> 
> cropParameterValueGroup.parameter(SOURCE_CROP_PARAMETER).setValue(gc);
> 
> cropParameterValueGroup.parameter(Crop.PARAMNAME_ROI).setValue(mp.buffer(1500));
> 
> Hints hints = new Hints();
> 
> return (GridCoverage2D) crop.doOperation(cropParameterValueGroup,
> hints);
> }
> Our code at pastie: http://pastie.org/4743401
> 
> At the last row I have:
> "org.geotools.coverage.processing.CannotCropException: An error occured
> while cropping". And that`s all, no full stacktrace. 
> 
> The error in idea debug mode:
> https://www.evernote.com/shard/s114/sh/5a6ed01e-e4af-48e4-b176-3ca87f469f6c/9dd0f87aaec2dc4876f565473f4f7b2b
> 
> Maven dependencies of our project at pastie: http://pastie.org/4743428
> 
> *The most strange thing* that we were able to run this code inside of
> geomajas application! But we can`t run the code now.
> 
> We tried to switch between different geotools versions: 8.1 , 9-SNAPSHOT,
> 2.7.5 - doesn`t work also.
> 
> Please, give me any advice/propositions on the issue.
> 
> Regards,
> Dmitry.
> 
> 
> 
> 
> --
> View this message in context: 
> http://osgeo-org.1560.n6.nabble.com/error-while-cropping-tp5002488.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com 
> (http://Nabble.com).
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected] 
> (mailto:[email protected])
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> 
> 


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to