The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [bash]

The Bourne-again shell (Bash) is a Bourne shell (sh) implementation with numerous additions. Bash is the default shell in many Linux distributions and on macOS. It is available on most modern operating systems, and has been ported to Windows.

Filter by
Sorted by
Tagged with
1
vote
0answers
41 views

GDAL or rasterio to find minimum extent of multple files in command line

I have two files, GeoTIFFs (.tif) in this case which need to be cropped to each other's minimum overlap, and have matching spatial resolutions. I also want to round their Pixel Size to a whole number (...
1
vote
2answers
72 views

Convert a tab (Mapinfo) file to ESRI Shapefile with ogr2ogr

I want to convert a tab file created with MapInfo to an ESRI Shapefile (.shp) using ogr2ogr in command line. I did the following ogr2ogr -f 'ESRI Shapefile' "file.shp" "file.tab" but it gives an ...
0
votes
0answers
32 views

Join attributes by location using gdal in command line

I have a Shapefile with lon-lat coordinates (points) and I want to join it with a vector grid. When using QGIS I do this with "Join attributes by location" , using as input layer the vector grid and ...
0
votes
0answers
106 views

Convert a raster to a polygon with gdal in command line

I want to convert a raster (agric.tif) to a polygon layer (agric.shp). I want to use gdal in command line since the QGIS (raster to polygon) seems to takes for ever (still running over an hour). I am ...
0
votes
1answer
40 views

gdal_grid does not work in cron but works in terminal

I use the gdal_grid interpolation command. When I work in the terminal everything works perfectly. However, when I try to run the command in the bash script from cron then it does not work. Bash ...
0
votes
1answer
58 views

How to convert an ASCII file (with lat,lon coordinates) to a shapefile using OGR?

I have an ASCII file with the following columns : ID, longitude, latitude, value Is it possible to use OGR (ogr2ogr or ogrinfo) in command line in order to open the ASCII file and convert it to a ...
0
votes
0answers
157 views

Alter and update a shapefile with a field from an ASCII file using ogr

I have a vector file "map.shp" with a field ID. I have an attribute table (data.txt) with the following fields: ID, value1, value2. The field ID is the same in both files. I want to update map.shp by ...
1
vote
0answers
23 views

Rasterio CLI warping multiple rasters like another raster in all minus one feature

I'm writing a bash script to warp all the rasters in a specific directory to match another raster. I'd like to warp all these rasters iteratively in to match the other raster in all was except shape ...
2
votes
1answer
91 views

dbf to shp within BASH (ogr2ogr would be ideal)

I have a CSV with many points and attributes that I'm trying to convert into a shapefile but I'm having no luck. I have installed gdal-bin and can use my terminal environment to create a shapefile ...
0
votes
1answer
1k views

Merge different KMZ layers to a unique KMZ file, a bash script

I have different .kmz files, each one contains a .png and a .kml, let's say: a.kmz, b.kmz, c.kmz. I would like to use a bash script to obtain a unique .kmz file, let's say d.kmz, that contains all the ...
1
vote
0answers
42 views

Linux (unix) bash, import multiple fgdb to PostGIS using find & ogr2ogr command

I have multiple file geodatabases in different folders and this is the command I made so far: find -path "*/V*/*.gdb" -o -path "*/W*/*.gdb" -o -path "*/R*/*.gdb" -o -path "*/WM*/*.gdb" | while read ...
0
votes
1answer
50 views

gdalwarp for clipping images using multiple polygon in a bash shell for loop

C:\OSGeo4W64\bin\gdalwarp.exe -dstnodata 0 -q -cutline D:\hillsborough_Images_work\split_Polygon\120-140k\Hillborough_FINAL_140000_region_IGD_120570003d29ed0dc.shp -crop_to_cutline -dstalpha -tr 0....
0
votes
1answer
51 views

Python 2.7, PgAdmin III & BASH 4.3.48: Error Invalid Provider when calling py script in bash script

I am working in Ubuntu 16.04 LTS This is my bash script; # Binarize raster for later polygon creation path=/home/rose/Desktop/test/DSM_BM24_2017_1000_4735.tif pathdir=$(echo $path | cut -d "/" -f 1,...
2
votes
1answer
196 views

Pipe, redirect or stream to osmfilter from “standard in” (stdin)

So many tools support chaining, or piping in data from standard input. This can decrease times needed for disk writing and also better use the memory of a machine. Examples of chaining: GDAL - "...
2
votes
1answer
48 views

Change column to row using awk inside of GRASS command [closed]

I have 2000+ raster files and counting their statistics. For now I am exporting all to Excel, but to work on it, I need better segregation. My output: Name1 1 123 2 243 3 455 Name2 1 432 3 655 ...
2
votes
3answers
238 views

Loop using variable - r.mapcalc GRASS GIS

I am doing threshold classification of NDVI rasters. One equation looks like that: r.mapcalc 'prog_r43_n65=if(ndvi_r43_n65>=0.6,1,2)' Now I want to make a loop for more than 2000 rasters, so I ...
3
votes
2answers
569 views

Calculate buffer / multi-ring buffer of geometry with GDAL / gdalUtils

I wonder if there is any way to calculate a buffer on a spatial data set with basic command line GDAL or the R interface gdalUtils. To specify the Q: I have a lot of points around the globe. For ...
4
votes
1answer
995 views

gdal_calc - How to calculate where raster A is not equal to raster B?

I have two binary rasters with values NaN and 254. I want to generate a new raster that consists of the pixels that have value NaN in raster A and 254 in raster B and vice versa - those should be 1, ...
0
votes
0answers
54 views

Data limits & runtime of shp2pgsql? [duplicate]

I am using shp2pgsql in a bash script to import shapefiles into postgres. I can successfully do this for shapefiles with hundreds of records however shapefiles with tens of thousands of records (in ...
1
vote
2answers
652 views

Execute GRASS modules in bash or python

I am a novice in writing scripts. I have a line geometry. Let's say line.shp. I want to smooth it with v.generalize, e.g. v.generalize input=line output=line_chaiken method=chaiken \ threshold=1 ...
11
votes
2answers
8k views

ogr2ogr merge multiple shapefiles: What is the purpose of -nln tag?

The basic script in order to iterate recursively over sub-folders and merge all shapefiles into single one is: #!/bin/bash consolidated_file="./consolidated.shp" for i in $(find . -name '*.shp'); do ...
4
votes
2answers
3k views

Extract information from gdalinfo/ogrinfo

In Bash scripts, I use gdal(srs)info / ogrinfo to get information from raster / vector files. To use this information in my scripts, I'm extracting information using grep ... e.g. like this (to ...
2
votes
2answers
675 views

How do I use gdal command-line utility to extract raster attributes as input for gdalwarp?

I need to reproject a raster into the same extent and resolution as an existing raster, and want to use the gdal command-line utilities to do it. How do I extract these values in a format I can use ...
4
votes
1answer
169 views

Batch Script to merge tab fles in a directory

Very similar to this question Merging multiple .tab files? can someone please help me with a batch script for this? Based on the answer in the above I have #!/bin/bash for i in *.tab; do ogr2ogr -...
1
vote
1answer
38 views

Problem with numeric variable in i.topo.corr

I have a script to do topographic correction on landsat images. Following the manual, I first have to create the illumination model. I do it with the following line: i.topo.corr -i --overwrite ...
1
vote
0answers
450 views

How to create a script using wgrib2 command [closed]

I have several model data with the following format postwrf_d01_YYYYMMDD_INIT_f00000.gr2 where INIT = 0000, 0600, 1200, 1800, each consisting of up to several hours of forecast (f00000 to let's say ...
2
votes
0answers
57 views

units for gdalwrap output extent

I am attempting to write a small bash script that will mass process a large number of raster .tif files. It should do the following: Clip to a smaller extent Reproject to UTM This is what I have, so ...
1
vote
1answer
145 views

Making GRASS GIS 7 Ubuntu bash file work on Windows 7

I have created this bash file (.sh) while working on watershed analysis stochastic simulation in GRASS GIS 7.0.2RC1, which is running on Ubuntu. It worked perfectly and I received the correct results. ...
3
votes
1answer
229 views

Mass reprojection of raster files in a loop [Linux]

I have a folder with numerous .asc raster files that each accompanied by a corresponding .prj file. The file basename is the same for both files. The projection however can vary between all of them (...
1
vote
0answers
315 views

TransCAD file format for matrix data

I've never used TransCAD before. I have what I believe to be a TransCAD matrix file called data.mtx which I would like to be able to convert to some other file formats. I would prefer to do this at ...
6
votes
3answers
414 views

How to run qgis scripts in parallel across remote server(s)

I have a stand alone python script using qgis that I wrote with the help of the SE question here The script takes three arguments being; an input file path, an output file path, and another input ...
0
votes
1answer
314 views

How to not process when query is outside the raster extent ? (Error when Completely Outside)

Given a West North East South bounding box, I want to crop this data from a hundreds of inputXX.tif. Nearly every times but once, the query first print out that it "falls completely outside raster ...
1
vote
0answers
264 views

GRASS GIS r.slope.aspect write errors

I am running into an error running r.slope.aspect I have never seen before. When I run it, I get the following output: r.in.gdal complete. Raster map <dem> created. WARNING: map [slope] - ...
0
votes
1answer
99 views

How to pass value of a band to and other band and change its value?

Using gdaldem hillshade, I get a one-band hillshade (download here, 2MB) : gdaldem hillshade crop_xl.tmp.tif Shadedrelief.tmp.tif -s 111120 -z 5 -az 315 -alt 60 -compute_edges I currently can ...