I've tried to figure this out on my own, but i am having a hard time finding relevant documentation. The Java documentation is great, but I cannot figure out how to convert it into python.
I have the following script to mark out a specific area on a Sentinel-1 image and then generate a png that shows the same thing. However the polygon that is created and added to the product is not shown in the generated image, as it only write out the selected band without any mask overlay.
If I open the new product (TEST_POLYGON.dim) in snap toolbox I can see that the polygon was created. Also if I then use the Export View as Image operation in snap, the image is generated with the polygon added. Is there a way to get the same result in python?
from snappy import ProductIO, GPF, ProgressMonitor
HashMap = snappy.jpy.get_type('java.util.HashMap')
product = ProductIO.readProduct('subTEST.dim')
### MAKING SHAPE
shapeFile = 'geometry_Polygon.shp'
params3 = HashMap()
params3.put('separateShapes', False) # ?
target0 = GPF.createProduct('Import-Vector', params3, product)
ProductIO.writeProduct(target0, "TEST_POLYGON", 'BEAM-DIMAP') # This product has the shape added.
### MAKING IMAGE
JPY = snappy.jpy
imageIO = JPY.get_type('javax.imageio.ImageIO')
File = JPY.get_type('java.io.File')
band = target0.getBand('Amplitude_VV')
image = band.createColorIndexedImage(ProgressMonitor.NULL)
name = File('test.png')
imageIO.write(image, 'PNG', name) # But the shape is not added to the image.
The Export View as Google Earth KMZ also generates an image that has the polygon added. Is there any way to generate a KMZ file using python?
Any help would be greatly appreciated.