Skip to main content
94 votes

Uninstalling QGIS that was installed using OSGeo

Just to elaborate on the comment on the above answer that It appears that the uninstall option no longer exists in the osgeo4w.exe installer. As of today, there is an option to uninstall but you have ...
User's user avatar
  • 1,233
16 votes
Accepted

Differences between OSGEO GDAL and GDAL python bindings?

As documented in https://pypi.org/project/GDAL/ plain "gdal" is deprecated and you should not use that for writing any new code Additionally, there are five compatibility modules that are ...
user30184's user avatar
  • 67.3k
15 votes

Uninstalling QGIS that was installed using OSGeo

Might add to the above entries with my current complete-removal workflow: Delete C:\OSgeo4w64 Delete C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OSGeo4W Delete C:\Users\%USER%\documents\...
obrl_soil's user avatar
  • 3,772
11 votes
Accepted

Crop a raster using rasterio and geopandas

The issue is resolved. The issue was I misread the documentation. On a second read, the rasterio.mask documentation clearly states that polygons should be a list of GeoJSON-like dicts. I found the ...
rosswin's user avatar
  • 371
10 votes
Accepted

How do I install the GDAL bindings for C#/.NET 4.5.1?

Get the package from NuGet and then you need to call static methodGdalConfiguration.ConfigureGdal() from GdalConfiguration.cs/vb at startup to set process environmental variables. Call ...
maeneak's user avatar
  • 276
10 votes

QGIS 3.0 can't load plugin processing, no module named 'osgeo', on Manjaro Linux

Install the python missing module: yaourt -S python-gdal Then install the pip package: pacman -S python-pip and install the missing modules using: pip install MissingModuleName
Trader Forex's user avatar
9 votes
Accepted

GDAL Python cut geotiff image

To cut an image (tif file) by using GDAL python library, and without gdalwarp utility, you need to find row and column raster indexes of top point [p1=(minX, maxY)] and bottom point [p2=(maxX, minY)]. ...
xunilk's user avatar
  • 30k
8 votes

No module named 'osgeo'

Try this, pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
Saroj Rai's user avatar
  • 259
8 votes

How to extract FileGDB's domains without ArcGIS?

I found a perfect answer for my question in a post I found in Alex Tereshenkov's blog. The post contains a python script for printing the FGDB's domains in python interpreter: from __future__ import ...
EranGeo's user avatar
  • 1,182
7 votes

GDAL/OGR Geometry Type Python

See the cookbook print(geom.GetGeometryName())
sgillies's user avatar
  • 9,056
7 votes
Accepted

Running script over every file in folder using GDAL in Python?

The python module glob is used to get all file names according to the pattern that you give it. The documentation for glob can be found here. Within your script you would use glob like this: ...
GeoSharp's user avatar
  • 3,266
7 votes

GDAL/OGR Geometry Type Python

It's possible to get the layer geometry type without reading a feature. ds = ogr.Open(your_input_file) layer = ds.GetLayer() layer_defn = layer.GetLayerDefn() ogr.GeometryTypeToName(layer_defn....
Deep's user avatar
  • 151
6 votes
Accepted

No module named 'osgeo'

This sounds like you have multiple python installations, and GDAL is installed on one and not the other. Try the following (which I have based upon this). Create a text file within your python ...
JimT's user avatar
  • 2,383
6 votes
Accepted

GDAL/OGR Geometry Type Python

I don´t want to be punctilious with the code, but you don´t need to loop all the features, the shapefile always store only one geometry type: # get the data layer layer = datasource....
user2232395's user avatar
6 votes

Docker container for OSGeo

There is a fairly large list of OSGeo Docker images here that are built on a variety of different base images. The page also contains information on the source, whether or not the image is on Docker ...
lambertj's user avatar
  • 3,057
5 votes

GDAL/OGR Geometry Type Python

I solved the problem as such: def geom_type(): shapefile_location = r"E:\Cameron\Python\GDAL\SHP\Cadastral_Parcels\Parcels.shp" shapefile = ogr.Open(shapefile_location) ...
WhaleShark's user avatar
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,065
5 votes
Accepted

Python 3.6 error import osgeo

I solved this problem by installing via Python PIP pygdal package. Firstly you need to check Gdal version installed on the machine, and install proper pygdal. $ gdalinfo --version GDAL 2.1.3, ...
sorryMike's user avatar
  • 191
5 votes

pyQGIS 3.0 script not running with processing import

I tested your code and stripped the problem down to the paths you are using. The error seems to be the forward slashes (/) that confuse your windows python installation. You should use backslashes on ...
root676's user avatar
  • 2,385
5 votes

Missing osgeo in QGIS 3.4 Madeira (macOS High Sierra)

I had the same problem and solved it by: removing both /Library/Frameworks/GDAL.framework and /Library/Frameworks/GEOS.framework downloading the old QGIS 3.0 installer from here and installing only ...
johwag's user avatar
  • 51
5 votes
Accepted

Open .tiff, set projection, then re-save in Python with GDAL

You need to open the second file in update mode, then dereference it to save and close it. roads = gdal.Open('road_lines.tiff', gdal.GA_Update) roads.SetProjection(prj) del roads # save, close ...
Mike T's user avatar
  • 42.2k
5 votes
Accepted

How to extract FileGDB's domains without ArcGIS?

Domains will be supported in GDAL 3.3 and they are already available in the current development version (the "main" branch). See https://gdal.org/drivers/vector/openfilegdb.html#vector-...
user30184's user avatar
  • 67.3k
5 votes
Accepted

Setting Config Options for GDAL using Python

Use the API rather than starting up a subprocess: gdal.SetConfigOption('GTIFF_REPORT_COMPD_CS', 'YES') print(gdal.Info(r'C:\users\mikel\GeoData\DSM.tif')) Works for me with my data.
user2856's user avatar
  • 67.2k
5 votes
Accepted

Export list of shapely.geometry.polygons as Esri shapefile

You can easily save them to a shapefile using geopandas. import geopandas as gpd from shapely.geometry import Polygon # polygons sample polygons = [Polygon([(0, 0), (1, 1), (1, 0)]), ...
Kadir Şahbaz's user avatar
5 votes

Cannot import QgsVectorLayer from osgeo.ogr

The osgeo module has never had QgsVectorLayer. That belong to qgis.core module. https://qgis.org/pyqgis/3.0/core/Vector/QgsVectorLayer.html
user30184's user avatar
  • 67.3k
5 votes
Accepted

How to extract the integer-based geometry type code from an OGR feature

After poking around a little longer, I found out that while OGR geometries don't have access to the GetGeomType method, they DO have access to the GetGeometryType method, which outputs exactly what I'...
Felipe D.'s user avatar
  • 2,689
4 votes
Accepted

Plot a surface with a DEM and mplot3d

1) In the first case, we have only the points and we need to construct a grid (regular or irregular) by interpolation. 2) In the second case, the raster is already a grid (regular) but Matplotlib ...
gene's user avatar
  • 55.1k
4 votes

Clipping GeoTIFF file by GeoJSON?

1) I just don't know how to convert .geojson file to .shp. This is a one of the bases of ogr Python. If you have a geometry, it is very easy to convert it to a shapefile # geojson is GeoJson ...
gene's user avatar
  • 55.1k
4 votes

Install osgeo live package in existing Ubuntu?

I have also Ubuntu 18.04 and I use OSGeoLive in a virtual machine. I've installed VirtualBox: sudo apt-get install virtualbox After it I downloaded the osgeolive-12.0-vm.7z from https://sourceforge....
Zoltan's user avatar
  • 7,400
4 votes

installing gdal from osgeo to work with GeoTIFF

Open Anaconda Prompt and write the following command: conda install gdal. This will install osgeo where both gdal (to manipulate raster data) and ogr (to manipulate vector data) are stored.
Marcelo Villa's user avatar

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