Hot answers tagged

91 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,193
48 votes
Accepted

What is OSGeo4W?

OSGeo: OSGeo is an umbrella organisation (Foundation) that supports many Open Source GIS Projects. Some of the more well known ones are: QGIS, GeoServer, and OpenLayers. Being part of OSGeo gives a ...
HeikkiVesanto's user avatar
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
  • 63k
12 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,682
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
9 votes

What is OSGeo4W?

Look at the OSGeo: Open Source Geospatial Foundation site. You will see that they support Desktop applications (GRASS GIS, QGIS,...), Web Mapping projects (OpenLayers, GeoServer,MapServer ...), ...
gene's user avatar
  • 54.4k
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
  • 29.6k
9 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
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
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,256
7 votes

GDAL/OGR Geometry Type Python

See the cookbook print(geom.GetGeometryName())
sgillies's user avatar
  • 8,996
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
7 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,132
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,363
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
  • 2,952
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,025
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
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
  • 181
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,375
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
  • 41.8k
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
  • 63k
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
  • 64.7k
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
4 votes
Accepted

Why is the first element of my WFS layer None instead of a feature?

You weren't requesting the first feature, you were requesting a feature with an FID of "0" and your WFS doesn't have a feature with an FID of "0". Why: The ogr.Layer.__getitem__ method which allows ...
user2856's user avatar
  • 64.7k
4 votes

Need File Geodatabase (*.gdb) read/write support in QGIS?

I see this: and my options in the OSGeo4W Setup ('advanced install') that are probably relevant were:
MC5's user avatar
  • 1,901
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
  • 54.4k
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
  • 54.4k

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