Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

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.

0
votes
1answer
19 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
41 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 ...
0
votes
0answers
12 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
61 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
311 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
31 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
0answers
22 views

gdalbuildvrt in Cygwin for multiple tif files gives error 4 does not exist in the file system, and is not recognised as a supported dataset name

I have downloaded two tiles (150/36 and 150/37) from Landsat7 and unzipped into working directory say "L7". I am trying to create a mosaic for all bands by following the link CreateLandsatMosaic. ...
0
votes
1answer
28 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
49 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
114 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 - "...
3
votes
1answer
45 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
189 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
447 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
795 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
45 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
530 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 ...
12
votes
2answers
7k 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
2k 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
563 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
144 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
36 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
380 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
49 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
0answers
129 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
215 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
302 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
391 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
283 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
237 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
98 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 ...