Import vector data (shapefile) from snappy (Python)

I’m trying to run ‘Land-Sea-Mask’ operator from Python.
I need to provide mask operator as a shapefile.
In other words, I nedd to provide following parameter:
-Pgeometry= Sets parameter ‘geometry’ to .

In SNAP Desktop I just use import data option:

and after that I can point the name of the imported shapefile.
However, I have no idea how to do that (import shapefile) in Python (I can’t find appropriate example). Could you help?

You can put the ImportVectorOp in front of the Land-Sea-Mask operator. This will add the shapefile as geometry to your product.

@marpet I’m not sure how should I use Import-Vector operator to get vector (which I will be able to use in Land Sea Mask).

Let me paste my current code:

file1 = sampleSHP # valid shapefile path (.shp)
separateShapes = False

HashMap = jpy.get_type('java.util.HashMap')
parameters = HashMap()
parameters.put('vectorFile', file1)
parameters.put('separateShapes', separateShapes)

product = file1
result = GPF.createProduct('Import-Vector', parameters, product)

so, when I execute
GPF.createProduct('Import-Vector', parameters, product)
I receive a
RuntimeError: ambiguous Java method call

when I tried to use
GPF.createProduct('Import-Vector', parameters)
I receive a
RuntimeError: org.esa.snap.core.gpf.OperatorException: Operator 'ImportVectorOp': Mandatory source product (field 'sourceProduct') not set.

I’ve tried to put source product within parameters:
parameters.put('sourceProduct', file1)
but the error message is exactly the same.

The problem here is that the type of the product parameter can not be determined. Try to use ProductIO.readProduct() or use the product where you want to add the vector data to.