Hot answers tagged

10 votes
Accepted

QGIS Linux: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found

Solution: os.environ["QT_QPA_PLATFORM"] = "offscreen"
datasciencebegginer's user avatar
8 votes
Accepted

Calling PyQGIS functions from external editors (Linux)

I use following intro for stand-alone applications: # the_app.py import os import sys from qgis.core import * from PyQt4.QtGui import * def main(): QgsApplication.setPrefixPath(os.environ['...
Detlev's user avatar
  • 4,558
8 votes

Is it possible to change default encoding for QGIS?

Go to the "Settings -> Options -> Data Sources" menu, and look for the checkbox "Ignore shapefile encoding declaration", when you uncheck it, the default encoding (for shapefiles) will be 'set to' ...
NettaB's user avatar
  • 1,926
8 votes

GeoServer Keeps Stopping Service

You are running GeoServer as a foreground process, so when you log out it is terminated. A quick and dirty way to avoid this is to use nohup (no hang up) like this: nohup sh startup.sh & But you ...
Ian Turton's user avatar
  • 80.4k
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
6 votes

Storing result from gdallocationinfo as variable in Python

You can capture standard out this way: from subprocess import Popen, PIPE cmd = ['gdallocationinfo', '-geoloc', '-valonly', src, lng, lat] p = Popen(cmd, stdout=PIPE) p.wait() val = p.stdout.read()
Roger Lew's user avatar
  • 161
6 votes
Accepted

JPEG Creation error in gdal

Assuming you really do need a JPEG output file, not a GeoTIFF with internal JPEG compression... The JPEG driver supports the CreateCopy but not the Create method. It's not mentioned specifically in ...
user2856's user avatar
  • 64.7k
6 votes

JPEG Creation error in gdal

I'm late to the party and don't have enough reputation to comment on the accepted answer, but I want to add a bonus. You can avoid the two-step process with the intermediate VRT file by using the /...
Robert St. John's user avatar
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
6 votes

Installing QGIS LTR instead of latest version on Ubuntu

QGIS 3.16 LTR will be installed when you change https://qgis.org/ubuntu into https://qgis.org/ubuntu-ltr in line sudo add-apt-repository "deb https://qgis.org/ubuntu $(lsb_release -c -s) main&...
Kadir Şahbaz's user avatar
5 votes
Accepted

Automated clearing /tmp using QGIS batch processing?

You could create a custom script in your model to clear the '/tmp' folder at the end of each run. There's numerous ways to delete files but I like to use shutil.rmtree which deletes all files/folders ...
Joseph's user avatar
  • 75.2k
5 votes
Accepted

Batch load multiple shapefiles to Postgis

If you are able to use ogr2ogr it will ignore create options when appending, and ignore append options when creating. for shp in $(ls *.shp); do ogr2ogr -f "PostgreSQL" PG:dbname=databasename -...
HeikkiVesanto's user avatar
5 votes

Loading Esri ArcGrid export file (e00) in R?

It appears you are dealing with an ArcInfo Exchange file - check this out How To: Import an ArcInfo interchange file (E00) in ArcGIS. Your trying to do this using R. If you wanted to use a command-...
whyzar's user avatar
  • 12k
5 votes

Execute GRASS modules in bash or python

In bash, you could do something like the following. I don't have your shapefile so I can't test that these are the exact commands that will work, but the approximate workflow may help you. # create ...
mankoff's user avatar
  • 1,630
5 votes

Aggregate Lines Based on Distance between Segments

You could try looking int this OS option, Skeletron, it: generalizes collections of lines to a specific spherical mercator zoom level and pixel precision, using a polygon buffer and voronoi ...
whyzar's user avatar
  • 12k
5 votes

Passing GDAL commands in Python using subprocess: errors

If its a relative path, you need a period in front of the file path, such as gdalinfo './Path/to/my/file.shp' or for the whole path you would specify with tilde such as gdalinfo '~/home//Path/to/my/...
Kartograaf's user avatar
  • 2,862
4 votes

Linux alternatives to visualize and analyze LiDAR datasets?

SPDlib provides a very comprehensive line tools for processing Laser Scanning data (both Terrestrial and Airborne data). It is available for Linux and can be easily installed using Anaconda. SPDlib ...
4 votes

Fixing ogr2ogr without spatialite support?

I'd just like to add that checking for Spatialite support via ogrinfo --formats sqlite | grep 'spatialite' -i and an output of SQLite -vector- (rw+v): SQLite / Spatialite does not guarantee support. ...
MapImbibery's user avatar
4 votes

running geoserver as background process in linux

If you are running GeoServer from the command line then you are only testing it and so should leave it running in a spare console window until done. In a production environment you need to use the ....
Ian Turton's user avatar
  • 80.4k
4 votes

Aggregate Lines Based on Distance between Segments

ArcGIS is the simplest if it is at all an option. I know the OP specifies OS but I mention this as the OS options just don't look very helpful compared to : http://resources.arcgis.com/en/help/main/10....
AnserGIS's user avatar
  • 1,068
4 votes
Accepted

Is there any existing postgis package for Ubuntu 16.04 (xenial) compiled against GDAL 2.0+?

The Ubuntu GIS team has GDAL 2.2.1 for Xenial and has PostGIS 2.3.3 compiled against it. From the PostGIS build logs checking for gdal-config... /usr/bin/gdal-config checking GDAL version... 2.1.3 ...
Evan Carroll's user avatar
  • 7,031
4 votes

Installing QGIS on Fedora?

Found libsz.so.2 in a local library used by another software on my machine (FME Desktop). Copied this file to /usr/lib and ran ldconfig. This solved my issue this time....
Saamot's user avatar
  • 71
4 votes

QGIS not available in Pop! Linux repo so how do I install it

Pop! is based on Ubuntu 18.04 so QGIS 2.18 is available by default and can be installed from the command line (or synaptic): sudo apt install qgis python-qgis qgis-plugin-grass QGIS is not available ...
user2856's user avatar
  • 64.7k
4 votes

Cannot create PostGIS extension with Ubuntu 18.04

If you are in Ubuntu, you can install it from packages! Instead of compiling them from source, you can just execute this command and all the required packages will be installed. sudo apt-get install ...
Gonzalo's user avatar
  • 141
4 votes
Accepted

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

If you run a QGIS Processing tool from the toolbox, you can then open the Processing History dialog from the Processing menu. Clicking any item in the history will show you an equivalent Python ...
ndawson's user avatar
  • 27.4k
4 votes

Running QGIS on command-line alone?

Assuming you want to use PyQGIS python scripts to automate your workflow, you could do something like the following (roughly based on what I do for automated testing of a QGIS 3 python plugin in my ...
user2856's user avatar
  • 64.7k
4 votes

How to make PROJ work via Anaconda in Google Colab?

After some stressful fight I managed to patch up a solution. I post the answer below because I believe a lot of people will hit the same problem trying to do geospatial work with Conda in Google Colab:...
Julian_P's user avatar
  • 307
4 votes
Accepted

Font "liberation sans" not available on system

If you cant or dont want to install new font on either operating system you may use an expression to set the font depending on the operating system. As there is a variable that return the curent OS ...
J.R's user avatar
  • 15.2k
3 votes
Accepted

Converting Python script for QGIS?

This should work: ##Database=group ##Access.mdb to SqLite=name ##inputmdb= input file ##outputsqlite = output file import sys, subprocess, os, sqlite3 as sql mdb_name = inputmdb sql_name = ...
ymirsson's user avatar
  • 884
3 votes

Linux Tool to visualize CityGML file

Aristoteles 3D (requires Java) is working on current versions of Ubuntu. From memory, the link I used was from https://www.citygmlwiki.org/index.php/Freeware, pointing to http://www.geo-kiosk.net/...

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