Convert between CSV and GeoTIFF with GDAL in Python

  Рет қаралды 20,931

Making Sense Remotely

Making Sense Remotely

Күн бұрын

Пікірлер: 52
@sandeepbhatti3124
@sandeepbhatti3124 Жыл бұрын
Thank you so much! I was looking to convert CSV to Tiff and none of other posts on internet seemed to work. Your tutorial was perfect solution to my use case. Thanks again!
@antonstsezhkin6578
@antonstsezhkin6578 Жыл бұрын
Bless you for covering different use cases! And thanks than mine is included.
@seyedpeyman6092
@seyedpeyman6092 10 ай бұрын
Useful and Clear ! Thank You for this Great Tutorial
@gunnarorsteinsson1170
@gunnarorsteinsson1170 3 жыл бұрын
Omg it worked, thank you! I'd been struggling with solving this particular problem for hours.
@johnegyir9704
@johnegyir9704 Жыл бұрын
Clearly explained! Thank you very much. This is really helpful.
@mountainmanpedro
@mountainmanpedro 2 жыл бұрын
This is such a clear and useful tutorial--thank you for this--extremely helpful.
@alejandrocalderon7452
@alejandrocalderon7452 2 жыл бұрын
You are amazing! Everything was so clear. Thank you very much!
@johnowusukonduah2305
@johnowusukonduah2305 2 жыл бұрын
Great video. This was what I've been looking for all this while. Thank you Madam.
@adeniranibrahim6071
@adeniranibrahim6071 2 жыл бұрын
Nice video. Detailed and explanatory
@gulnihalkurt1761
@gulnihalkurt1761 2 жыл бұрын
amazing tutorials
@oceancolor1069
@oceancolor1069 2 жыл бұрын
hot damn ... thank you so much!
@rodrigo.cedeno
@rodrigo.cedeno 3 жыл бұрын
Great tutorial! It really helped me a lot! Thank you!
@lluisarruevicedo933
@lluisarruevicedo933 3 жыл бұрын
where are you from? I need to find you to thank you taht you just saved my day! Pd. Don't tell my boss you told me how to do my work hahahahah
@elnuisance
@elnuisance 3 жыл бұрын
I only have a csv file with x, y, z(value) data. I am trying to interpolate them by rasterizing using your method. But I am stuck at xRes, yRes
@brianlee5287
@brianlee5287 3 жыл бұрын
Very great tutorial! Do you have any advice on converting from xy to lat long?
@makingsenseremotely6207
@makingsenseremotely6207 3 жыл бұрын
I use geopandas. Here is an example that I have for converting lat/lon into UTM coordinates. You would just have to switch the EPSG codes. gdf = df.set_geometry(gpd.points_from_xy(df.longitude, df.latitude), crs="EPSG:4326") proj_df = gdf.to_crs("EPSG:32719") df["x"] = proj_df.geometry.x df["y"] = proj_df.geometry.y
@brianlee5287
@brianlee5287 3 жыл бұрын
@@makingsenseremotely6207 Very useful! I ended up using osr/ogr to transform the spatial reference, but geopandas is much more elegant. Thanks for the channel!
@stozi92
@stozi92 3 ай бұрын
Thanks for the video. How can I convert X and Y to Lat and Lon in a csv file?
@liminzhang5516
@liminzhang5516 2 жыл бұрын
Thank you for your great info. after I run this line code dfn = pd.DataFrame({"x":x, "y":y, "value":flat}) raise ValueError("arrays must all be same length") ValueError: arrays must all be same length is my DEM.TIF file not right? can you post your DEM.TIF file download link?
@mahsabozorgi
@mahsabozorgi Жыл бұрын
Thank you for the video, How can I conver GeoTIFF to Binary?
@asmitasubedi8215
@asmitasubedi8215 3 жыл бұрын
Thank you for the video! How can I convert a number of .hdf files to csv? Any help would be appreciated.
@saisskumar1502
@saisskumar1502 3 жыл бұрын
Hi. I am getting the "Null pointer received" error.. what is the fix? I followed the steps as it is.
@anusrutimitra1115
@anusrutimitra1115 3 жыл бұрын
is it possible to make landsat 8 geotiff to csv?
@theproudsanatanikafir6656
@theproudsanatanikafir6656 3 жыл бұрын
heyyyy! it is python so you can do any thing
@pratikbhattacharjee2025
@pratikbhattacharjee2025 2 жыл бұрын
I have successfully converted the xyz file to a GeoTif format with no error message. But the output GeoTif file is not there in my directory and the variable is empty too.
@Theworldfrommyeye.x
@Theworldfrommyeye.x 3 жыл бұрын
Please make some videos on conversion of .grd file to CSV. It would be great if you can guide me to do so. I am thinking of using python mrgs and gdal public libraries.
@heetjoshi1910
@heetjoshi1910 3 жыл бұрын
I have tried your way to make Geotiff from CSV but the problem is whatever input Lat-Long I have given, when I'm checking my output geotiff's Lat-Long, They both are not same. How is it possible?? Thank you very much for your tutorial.
@johnowusukonduah2305
@johnowusukonduah2305 2 жыл бұрын
How can we do similar for multiband raster?
@MuradEllafi
@MuradEllafi 3 жыл бұрын
I got this error : ModuleNotFoundError: No module named 'sogeo' can you help me please?
@mariafernandamoralesoreamu6019
@mariafernandamoralesoreamu6019 4 жыл бұрын
Hi! If i want to interpolate to a new cell resolution (size) in the output raster, what do I have to add to the gdal.grid code? For example, I had a 1000x1000 cell resolution, which gave me the xyz coordinate points, and I want the interpolated raster with a new cell resolution of 10x10 m. Thanks!
@makingsenseremotely6207
@makingsenseremotely6207 4 жыл бұрын
Hi. For some reason, there is no gdal.Grid() option to set the x+y resolution of the output raster, only height+width in pixels. The command-line version of that program, however, allows you to specify a target resolution. So you have two options: 1) run gdal_grid as a subprocess and specify the output file resolution with -tr 10 10 2) resample the interpolated raster to the desired resolution with gdal.Translate() or gdal.Warp()
@mariafernandamoralesoreamu6019
@mariafernandamoralesoreamu6019 4 жыл бұрын
@@makingsenseremotely6207 Thanks! It works with using gdal_grid as a subprocess. But now I get the error "Failed to find field 'z' on layer file, skipping", so it returns an empty raster. Do you know why this could be? I checked with ogrinfo and the points appear to have a Z value.
@makingsenseremotely6207
@makingsenseremotely6207 4 жыл бұрын
What format does your input data have? If you are using csv + vrt, then make sure that in the vrt file, the value for z under Geometry Field corresponds to the z column name in your csv file. If you are directly using e.g. a shapefile as input, try explicitly setting the z value with the option -zfield "whateveryourfieldnameis"
@stergiod5995
@stergiod5995 4 жыл бұрын
hey, first of all thank you for your videos!! I have a question, what about change jp2 raster (like Sentrinel) to tiff? I am trying to translate all the bands as tiff in a new folder. Thanks anyway.
@makingsenseremotely6207
@makingsenseremotely6207 4 жыл бұрын
Hey, if you want to convert each band to a separate new tiff, gdal.Translate("output.tif", "input.jp2") should work. If you want to merge all jp2 files into one multiband tiff raster, build a virtual raster with gdal.BuildVRT() first. Be sure to set separate = True, so each input file will be placed in a separate band. Then you can translate the vrt file to tiff with gdal.Translate().
@stergiod5995
@stergiod5995 4 жыл бұрын
@@makingsenseremotely6207 Yeap i found it! Thanks anyway I did it like this, i needed the bands seperated. for image in rawSat_folder: raw = gdal.Open(f'{RawSat_folder}/{image}') trans = gdal.Translate(f'{satImage_folder}/{image}.tiff', raw) trans = None
@yuhuibao1728
@yuhuibao1728 3 жыл бұрын
Very impressive, hope one day i could write code without looking turorial everywhere.
@mohammadferdosian6173
@mohammadferdosian6173 4 жыл бұрын
Hi, do you have any ENVI tutorial ?
@techstarplus
@techstarplus 3 жыл бұрын
kzbin.info/www/bejne/qZqzXoKcg7ughdk
@antonstsezhkin6578
@antonstsezhkin6578 Жыл бұрын
Oh! one more thing: you operate with x and y - which one should be latitude and which one the longitude?
@ecoro_
@ecoro_ 10 ай бұрын
x is lon and y is lat, like in a map ... right?
@antonstsezhkin6578
@antonstsezhkin6578 10 ай бұрын
@@ecoro_ thanks!
@repsolrider6877
@repsolrider6877 3 жыл бұрын
i have a 2.5Gb GeoTiff image and i used your code to extract pixel and its values but, the xyz file size is going on increasing it got upto almost 21gb and my anaconda environment got crashed, it happens everytime i run the code, can you help me where i was doing wrong?
@makingsenseremotely6207
@makingsenseremotely6207 3 жыл бұрын
As I mentioned in this video, it is not a good idea to do this for very large data sets, because the xyz files will get huge. Try to subset your data or just work with it in geotiff format. If you just want to extract pixel values at certain locations, there are better ways to do this than just turning the entire raster into xyz. Here is an example: gis.stackexchange.com/questions/317391/python-extract-raster-values-at-point-locations
@repsolrider6877
@repsolrider6877 3 жыл бұрын
By increasing the paging file size to 100Gb did the trick, i got output csv file of 12gb, btw this GeoTiff image is our whole state so i need each and every pixel data and their coordinates to store it in db for future usage, and thank you so much your code helped me a lot, before py i used rasterToPoints() function in R to get coordinates and values of every pixel, but it got crashed every time, so i switched to py spyder and increased paging file size, i got output in 10min. About the link you gave me i have doubt, i have single GeoTiff file and i want to clip this GeoTiff file using coordinates only, not by shape file, csv file or extents how can we do that, that links suggests using shape file, thanks in advance
@makingsenseremotely6207
@makingsenseremotely6207 3 жыл бұрын
Glad to hear you found a way to make it work for you. The link I sent you is not about clipping a raster, but about extracting raster values at specific point locations. For clipping a geotiff file with coordinates I use gdal.Warp("dem_clipped.tif", dem, outputBounds = (xmin, ymin, xmax, ymax), dstNodata = -9999)
@repsolrider6877
@repsolrider6877 3 жыл бұрын
I'm assuming the "dem" in the gdal.Warp() function is a dataframe which consists coordinates of a polygon right? If yes, can you show me few rows(3 should be enough) of that dataframe.
@makingsenseremotely6207
@makingsenseremotely6207 3 жыл бұрын
No. The dem is the dataset/geotiff that you want to clip (opened as gdal.Dataset). You could also just provide the filename, e.g. "dem.tif". It's further explained in my "Splitting raster data" video.
Spatial Interpolation with GDAL in Python #1: Nearest Neighbor and Moving Average
20:54
Splitting raster data into equal pieces with GDAL in Python
15:40
Making Sense Remotely
Рет қаралды 11 М.
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 11 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 50 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 9 МЛН
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 190 МЛН
Automating Raster Data Extraction using Python
21:36
GeoDelta Labs
Рет қаралды 14 М.
Reproject, resample and clip raster data with GDAL in Python
7:47
Making Sense Remotely
Рет қаралды 22 М.
Processing DEMs with GDAL in Python
12:04
Making Sense Remotely
Рет қаралды 14 М.
Chat with a CSV | LangChain Agents Tutorial (Beginners)
26:22
Alejandro AO - Software & Ai
Рет қаралды 69 М.
Visualizing multi-band satellite images in Python
16:07
Making Sense Remotely
Рет қаралды 12 М.
Merge raster data with GDAL in Python
6:09
Making Sense Remotely
Рет қаралды 18 М.
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 11 МЛН