Geographic Information Systems Asked on January 3, 2022
I have a raster in which I’d like to cut a “hole” with a shapefile. I have points close to the boundary, but inside the hole, and I would like to find the closest point on the edge. To give a concrete example, I have a global dataset (1′ resolution) and a shapefile of the coast of Africa. My data points are locations of cities near the coast, but some of these points are not exactly on the coast, so I’d like to find the closest point outside the shapefile, i.e. closest point over water.
Normally, I’d use: gdalwarp -of -GTiff -cutline Coast.shp -crop_to_cutline -dstnodata 0.0 Data.tif Clipped_Data.tif
but this obviously only gives me what’s inside the shapefile; I can’t find an inverse clipping for this command.
I did some digging and found this, which allowed me to set everything inside the shapefile to 0, but when I sample using gmt grdtrack
it just sets the values to 0 (which makes sense). Also, when I tried crop=True, invert=True
I got: ValueError: crop and invert cannot both be True.
So I reverted to using crop=False, invert=True.
So, how can I sample this raster at the closest point outside the shapefile? I think if I can get the hole to be set to NaN, I can use the -T flag in gmt grdtrack.
Take a look at mapproject -L option. I think it does what you want and no need to use a grid.
Answered by J Luis on January 3, 2022
0 Asked on September 1, 2020 by albine-pro
1 Asked on September 1, 2020 by arnpry
0 Asked on September 1, 2020 by sargam-panwar
1 Asked on August 31, 2020 by ali-mokhtari
1 Asked on August 31, 2020
1 Asked on August 30, 2020 by tomas
0 Asked on August 30, 2020 by jjd
1 Asked on August 30, 2020 by jordy-w
1 Asked on August 30, 2020 by pileoni
1 Asked on August 30, 2020 by pac_co
2 Asked on August 30, 2020 by npt_rich
2 Asked on August 29, 2020 by aviddabbler
1 Asked on August 29, 2020 by guy-forssman
1 Asked on August 29, 2020 by salrad
1 Asked on August 28, 2020 by david1212k
dark object subtraction pyqgis 3 python qgis plugins sentinel 2
2 Asked on August 28, 2020 by sam-murphy
1 Asked on August 27, 2020 by wout
1 Asked on August 26, 2020 by icypy
Get help from others!
Recent Questions
Recent Answers
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP