Free Support Forum - aspose.com

Cropping a Raster Image using Vector Shape

I am wondering if there is a built-in or easy method to clip or crop a raster file using a vector shape. For example, let’s say I have a geotiff satellite data file, but have a specific area of interest in WKT. I’d like to crop the raster to my area of interest bounding rectangle and then mask so anything outside my AOI is transparent. Is this possible with Aspose.GIS?

Hi, @msmearer

Thank you for your interest in the Aspose.GIS product.

Unfortunately, by the moment Aspose.GIS has no option to clip or crop a raster layer using shape form. I have created a ticket GISNET- 1219 and update you here as soon as additional information is available.

Please feel free to contact us if you have any other issues or product questions.

Thank you for the quick response!

Greetings,

I second that request. Was actually creating a post for a similar/the same request. Basically it would be great to obtain an XYZ web tile layer and overlay it onto an extent of a vector shape an then clip/crop the web tile layer so that only the area of the web tile(s) which fit the extent is actually displayed.

Theres actually an online SVG implementation of this written in javascript if you are interested in the link.

Hi, @yemoku

Thank you for paying attention to this topic. I have raised the priority of the GISNET- 1219 ticket.

Thanks for the second, @yemoku. I’ve done more digging around and have a very rough working example using GDAL warp with a “cutline”. It’s complicated, feels a bit fragile, and involves several data format transformations. I’d love a fully managed .Net way to do this!

I appreciate the bump, @Evgeniy.Timofeev.

Interesting.

I was looking at the javascript (node.js) route to achieve this since Mike Bostock had already put up a great working sample in D3 (D3 Sample)

But hopefully the Aspose.GIS team will be able to pull this off in a much cleaner fashion.

thanks, we will try to make the implementation as good as possible