3

Is there any simple way to change this command:

gdalwarp -tr 10 10 -cutline "shape.shp" -crop_to_cutline -of GTiff "S1A_IW_GRDH_1SDV_20200719T161950_20200719T162015_033526_03E28C_C720.SAFE.tif" "S1A_IW_GRDH_1SDV_20200719T161950_20200719T162015_033526_03E28C_C720.SAFE.tif"

to the one that would clip to cutline, but with negative buffer in meters (if not, at least in pixels?)

Input data is WGS84 UTM zone 34N.

1 Answer 1

2

you may want to just issue the buffer command in Spatialite SQL. Easiest to do it in two steps:

  1. Create buffer, check it's what you want
  2. Amend your command to use the new shapefile.

Or you can put the SQL directly in gdalwarp using the -csql options. Harder to debug!

ogr2ogr -f "ESRI Shapefile" -dialect SQLite \
        -sql \
 "select ST_Buffer(ST_Transform(geometry, 32634), -10) from shp_in" shp_out.shp shp_in.shp

(all in one line without the \, I'm not sure this will work as typed!)

2
  • as far as I know this is not -10 meters in WGS84, but degrees, am I wrong? Feb 15, 2022 at 16:02
  • Ooops, I'm sorry, I forgot about adding the transform. Check the above edits (haven't been able to test). I assumed that your vector data is WGS84 lat/long (e.g.) and you want to convert to UTM34N.
    – Jose
    Feb 15, 2022 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.