Skip to main content
12 votes
Accepted

Trying to run GDALbuildVRT in command line

The problem is that this construction is trying to look for a "data" folder within your existent "...\Vector Map District Raster\data" folder. Since there is no such "...\data\data" folder, it returns ...
Roberto Ribeiro's user avatar
12 votes
Accepted

What are GDAL utilities?

What is GDAL? GDAL (Geospatial Data Abstraction Library) is a library for reading and processing raster and vector geographical data. It's the backbone of many GIS software, including ArcGIS and QGIS....
Roberto Ribeiro's user avatar
11 votes

Error when using gdal_calc.py

This seems to be a quoting issue. Try running: subprocess.call([sys.executable, 'C:\\PROGRA~2\\GDAL\\gdal_calc.py', '-A', 'd:\\mnt_5x5.tif', '--outfile=d:\\test.tif', '--calc=A+1']) The --calc=A+1 ...
Charlie Lefrak's user avatar
11 votes

Command line-tool to convert geojson file to line-delimited geojson

Borrowing from this StackOverflow answer and using the jq command line tool you can filter GeoJSON feture objects and dump them as new-line delimiter with: cat my.geojson | jq -c ".features[]" > ...
om_henners's user avatar
  • 15.7k
9 votes

Count number of vertices in a shapefile using OGR

To extract the total number of vertices in a shapefile, I'd simply use a bit of Spatialite SQL: ogrinfo states.shp -dialect SQLite -sql "SELECT sum(ST_NPoints(geometry)) AS n_vertices FROM states" ...
Antonio Falciano's user avatar
9 votes
Accepted

Use Orfeo Toolbox in R

OTB algorithms are in OTB_installation_path/bin. So, as you can use them in command line (see more in documentation), the same way could be used trough R by system function. You can create your owns ...
aldo_tapia's user avatar
  • 13.7k
9 votes
Accepted

What is the "command line" in QGIS on Mac?

The command line lives in two places. It depends on how you decide you'd like to start scripting and automating tasks that are often tedious or time consuming when done manually. First place is in ...
SaultDon's user avatar
  • 10.4k
7 votes
Accepted

ogr2ogr won't read directory of GeoJSON into GPKG

The "directory as dataset" is a specific feature of the shapefile driver. From http://www.gdal.org/drv_shapefile.html : Normally the OGR Shapefile driver treats a whole directory of shapefiles ...
BradHards's user avatar
  • 12.9k
7 votes
Accepted

ogr2ogr too many GCP points - exceeds maximum number of characters in the command line

This page, which lists general command-line options, says there's an "--optfile" argument: Read the named file and substitute the contents into the command line options list. Lines beginning with # ...
mikewatt's user avatar
  • 5,093
7 votes

Call QGIS geoprocessing tools from command line (terminal, bash-script)

Starting with the release of QGIS 3.14 there is a real QGIS command line mode to use QGIS Processing Algorithms (including GDAL, SAGA and GRASS). It's called qgis_process. See the change log and ...
D Pilon's user avatar
  • 608
7 votes
Accepted

ogr2ogr commands with cmd

To debug the command, it can be helpful to echo it instead of running it, to see if any special characters are throwing things off. From inside a bat file, do: echo ogr2ogr -sql "SELECT * FROM 'D:\...
mikewatt's user avatar
  • 5,093
7 votes
Accepted

Unable to run qgis_process from command line for native:atlaslayouttopdf QGIS algorithm

There's a typo in your command: --project=... should be --project_path=...
ndawson's user avatar
  • 27.6k
6 votes
Accepted

How do you close the QGIS Commander in 2.18?

Inside the commander command line, press the escape key
JGH's user avatar
  • 42.1k
6 votes

Converting large CSV to line-delimited GeoJSON?

Since I'm comfortable with Node, I came up with this stream-oriented script. It's easy to transform values in the process. #!/usr/bin/env node const fs = require('fs'); const turf = require('@turf/...
Steve Bennett's user avatar
6 votes

Prioritising polygons in QGIS

This should work if($area/10000 > 10,1,if($area/10000 < 1,3,2)) Just a capsuled if-condition, first checking for areas greater 10 ha, then checking for those smaller than 1 ha, then giving ...
Erik's user avatar
  • 16.4k
6 votes

Prioritising polygons in QGIS

Using the CASE-statement CASE WHEN "Size ha" >= 10 THEN 'Prio 1' WHEN "Size ha" > 1 AND "Size ha" < 10 THEN 'Prio 2' WHEN "Size ha" <= 1 THEN 'Prio 3' END Or as was provided by @...
Taras's user avatar
  • 33k
6 votes

Running QGIS on command-line alone?

Starting with the release of QGIS 3.14 there is a real QGIS command line mode to use processing algorithms It's called qgis_process. See the change log and search for the new feature: New standalone ...
D Pilon's user avatar
  • 608
5 votes

Efficiently convert from Shapefile to GeoJSON without GDAL

Pyshp reads and writes shapefiles, no other formats, in Python: pip install pyshp. You can use its Python geo protocol to get GeoJSON-like representations of features and then use Python's json ...
sgillies's user avatar
  • 9,046
5 votes

Count number of vertices in a shapefile using OGR

I accomplished it using the following command: ogrinfo -al myshapefile.shp | grep POLYGON | sed 's/$/,/' | tr -d -c "," | wc This begins by printing the shapefile contents to stdout, including all ...
Richard's user avatar
  • 1,831
5 votes

ogr2ogr add geometry from x y when importing to postgis

If the data is now in your database you can use ST_MakePoint or ST_GeomFromText to construct a geometry object from your x and y columns, e.g.: --ST_SetSRID is also used here as ST_MakePoint will ...
Ali's user avatar
  • 4,055
5 votes
Accepted

Command line-tool to convert geojson file to line-delimited geojson

I wrote a dedicated command-line tool on NPM to do this, now: https://www.npmjs.com/package/geojson2ndjson Usage npm install -g geojson2ndjson geojson2ndjson myfile.geojson | ... Or ...
Steve Bennett's user avatar
5 votes

Command line-tool to convert geojson file to line-delimited geojson

You can use ogr2ogr: ogr2ogr -f GeoJSONSeq ~/Downloads/data.geojson.ld ~/Downloads/data.geojson
dsummersl's user avatar
  • 151
5 votes
Accepted

Translate manual operations to GRASS commands

Start any GRASS module through the GUI (e.g., File > Import raster data > r.in.gdal), and set all the options as you want them. Then, instead of clicking the "run" button, instead click "Copy." This ...
Computarch's user avatar
5 votes
Accepted

Cannot run qgis_process on WSL2, its trying to connect to a display

It is unfortunately not entirely clear from your question how you are calling qgis_process, but I'm attempting to answer anyways because I did run into the exact error before. If you want to call the ...
CodeBard's user avatar
  • 3,551
5 votes

Command line/Python (Linux) GDAL Warp result much bigger than in QGIS (Windows)

Without your source data the best test I could make was to create as similar input file as you have with the gdal_create utility https://gdal.org/programs/gdal_create.html. I used GDAL 3.7.0dev on ...
user30184's user avatar
  • 66.3k
4 votes

Error when using gdal_calc.py

Try to use os instead of subprocess. This worked for me: import os gdal_calc = 'python C:/PROGRA~2/GDAL/gdal_calc.py -A d:/mnt_5x5.tif --outfile=d:/test.tif --calc="A+1"' os.system(gdal_calc)
YuriTheFury's user avatar
4 votes
Accepted

Set default GDAL/OGR config options?

To answer your question directly - no, I don't think it's possible. To workaround, use the *nix alias concept... On Windows: You can make your current method permanent by using setx or the Windows ...
user2856's user avatar
  • 66.5k
4 votes

Alternative to Tippecanoe for generating Mapbox vector tiles on command-line

Tippecanoe is designed for lines and polygons as well. Here's a recommended starting point for representing polygons at all zoom levels, with one property you want to aggregate at low (zoomed-out) ...
Ryan Baumann's user avatar
4 votes

Trying to run GDALbuildVRT in command line

*tif will not get expanded into subdirectories of .../data. You must use an input file list as described in http://www.gdal.org/gdalbuildvrt.html -input_file_list: To specify a text file with ...
user30184's user avatar
  • 66.3k
4 votes

Command line-tool to convert geojson file to line-delimited geojson

Tippecanoe also has this functionality built in: tippecanoe-json-tool source.json > out.nd.json I've only tested with small examples, but given that tippecanoe is blazing fast and built for giant ...
Charlie Lefrak's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible