GPT Subset using WKT

Hello,

i am trying to create a spatial/spectral subset from my L2A-Sentinel2A datasets via gpt command line interface. I believe my command syntax is correct like this:

gpt Subset D:\beck_ct\data\s2a\L2A\uk_ireland\L2A_USER_20151222T161456_R023\S2A_USER_MTD_SAFL2A_PDMC_20151222T161456_R023_V20151221T115730_20151221T115730.xml -PcopyMetadata=true -PgeoRegion='Polygon ((-0.93858417847800246 53.72518859837806104,-1.25075074982765022 53.7251885978246051,-1.25075075054579199 54.0266890965491271,-0.93858417858413867 54.02668909662935448,-0.93858417847800246 53.72518859837806104))' -PsourceBands=B1,B2,B3,B4,B5,B6,B7,B8,B8A,B9,B11,B12,quality_scene_classification -t D:\beck_ct\data\s2a\L2A\uk_ireland\tif\L2A_USER_20151222T161456_R023.tif -f GeoTIFF-BigTIFF

I keep getting the following error when executing the command in WindowsPowerShell:
`Unerwartetes Token “53.72518859837806104” im Ausdruck oder in der Anweisung.
Bei Zeile:1 Zeichen:244

  • gpt Subset D:\beck_ct\data\s2a\L2A\uk_ireland\L2A_USER_20151222T161456_R023\S2A_USER_MTD_SAFL2A_PDMC_20151222T161456_
    R023_V20151221T115730_20151221T115730.xml -PcopyMetadata=true -PgeoRegion=‘Polygon ((-0.93858417847800246 53.7251885983
    7806104 <<<< ,-1.25075074982765022 53.7251885978246051,-1.25075075054579199 54.0266890965491271,-0.93858417858413867 54
    .02668909662935448,-0.93858417847800246 53.72518859837806104))’ -PsourceBands=B1,B2,B3,B4,B5,B6,B7,B8,B8A,B9,B11,B12,qu
    ality_scene_classification -t D:\beck_ct\data\s2a\L2A\uk_ireland\tif\L2A_USER_20151222T161456_R023.tif -f GeoTIFF-BigTI
    FF
    • CategoryInfo : ParserError: (53.72518859837806104:String) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : UnexpectedToken`

However if i execute the same command in classic cmd from windows there is no error messaged. In both cases there is no output created. I already tried to shorten the floating number from the wkt polygon - sadly with no effect.

Could you give me a hint, what Token in the command could be the problem?

Thanks for any help!
Chris

As I wanted to replicate your error PowerShell complained at a different position:

In Zeile:1 Zeichen:430
+ ... 0.93858417847800246 53.72518859837806104))" -PsourceBands=B1,B2,B3,B4 ...
+                                                                 ~
Argument in der Parameterliste fehlt.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingArgument

After putting B1,B2,B3,B4,B5,B6,B7,B8,B8A,B9,B11,B12,quality_scene_classification also in single quotes it seems to work.
Additionally I had to put ‘.’ at the beginning, otherwise the local gpt is not called.
So in the end my call looked like this.

PS C:\Program Files\snap_3\bin> .\gpt Subset D:\beck_ct\data\s2a\L2A\uk_ireland\L2A_USER_20151222T161456_R023\S2A_USER_MTD_SAFL2A_PDMC_20151222T161456_R023_V20151221T115730_20151221T115730.x
ml -PcopyMetadata=true -PgeoRegion='Polygon ((-0.93858417847800246 53.72518859837806104,-1.25075074982765022 53.7251885978246051,-1.25075075054579199 54.0266890965491271,-0.93858417858413867
54.02668909662935448,-0.93858417847800246 53.72518859837806104))' -PsourceBands="B1,B2,B3,B4,B5,B6,B7,B8,B8A,B9,B11,B12,quality_scene_classification" -t D:\beck_ct\data\s2a\L2A\uk_ireland\tif
\L2A_USER_20151222T161456_R023.tif -f GeoTIFF-BigTIFF

OK, I got an error: Error: Das Gerät ist nicht bereit
I think because I don’t have the files which are specified.

I tried your suggested changes and executed this bit of code here:
C:\Users\beck_ct\Programs\snap\bin> .\gpt.exe Subset D:\beck_ct\data\s2a\L2A\uk_ireland\L2A_USER_20151222T161456_R023\S2A_USER_MTD_SAFL2A_PDMC_20151222T161456_R023_V20151221T115730_20151221T115730.xml -PcopyMetadata=true -PgeoRegion='Polygon ((-0.93858417847800246 53.72518859837806104,-1.25075074982765022 53.7251885978246051,-1.25075075054579199 54.0266890965491271,-0.93858417858413867 54.02668909662935448,-0.93858417847800246 53.72518859837806104))' -PsourceBands='B1,B2,B3,B4,B5,B6,B7,B8,B8A,B9,B11,B12,quality_scene_classification' -t D:\beck_ct\data\s2a\L2A\uk_ireland\tif\L2A_USER_20151222T161456_R023.tif -f GeoTIFF-BigTIFF

Unfortunately there are still no outputs.
Maybe reinstalling SNAP ?

Could you please add the following lines to the gpt.vmoptions file:

-Dinstall4j.noLoggingFix=true
-Dsanp.debug=true

Maybe the resulting log will give some information what’s going wrong.

Additionally you can added -e to your command. This will force gpt to be more verbose if an error occurs.