Skip to main content

Questions tagged [osgeo]

The Open Source Geospatial Foundation (http://www.osgeo.org), or OSGeo, is a not-for-profit organization whose mission is to support and promote the collaborative development of open geospatial technologies and data.

60 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7 votes
2 answers
2k views

Adding support to Esri's FileGDB driver when fiona/gdal/osgeo were installed through Anaconda

Is there a way to tweak the fiona/gdal/osgeo packages installed through Anaconda so that they can be used to read/write GDB files using the ESRI FileGDB driver? The main thing I'm actually trying to ...
Felipe D.'s user avatar
  • 2,629
5 votes
0 answers
218 views

Python osgeo/OGR not returning all features in PBF

I have a PBF file that is a limited export of the Nepal area. I'm trying to pull out all the adminstrative boundaries. If I use osmconvert to turn my PBF file into a OSM file, sure enough I see the ...
Nicolas Pottier's user avatar
5 votes
0 answers
872 views

Install OSGeo module in virtualenv

How can you install the osgeo module in a virtualenv? I downloaded QGIS using KyngChaos (www.kyngchaos.com/software/qgis) following https://arset.gsfc.nasa.gov/sites/default/files/land/webinars/...
William L's user avatar
4 votes
1 answer
783 views

Is there a GDAL function similar to OpenCV's WarpPerspective?

I't trying to mosaic a GeoTiff raster against another. Initially, they were both georeferenced in WGS-84 CRS. Using OpenCV, I calculated a homography transformation (a 3x3 projection matrix), that ...
zuzaanto's user avatar
3 votes
0 answers
783 views

ModuleNotFoundError: No module named 'osgeo_utils'

I am trying to run GDAL commands from a python script but I keep getting this error from osgeo_utils.gdal_calc import * # noqa ModuleNotFoundError: No module named 'osgeo_utils' If I try pip install ...
guest_98732012's user avatar
3 votes
0 answers
129 views

Specifying geoid grid for osr.SpatialReference instance

How can I specify e.g. Geoid 12A or Geoid 18 when (for example) converting NAVD88 orthometric heights to ellipsoid heights using the OSR Python bindings? I would like to be able to specify any .gtx ...
corvus's user avatar
  • 526
3 votes
0 answers
1k views

OSError - cannot import geopandas

While trying to import geopandas error occurs: Exception has occurred: OSError Could not find lib geos_c.dll or load any of its variants []. I downloaded GDAL and fiona for Python 3.7 from this ...
katpio6's user avatar
  • 31
3 votes
1 answer
2k views

GDAL polygonize only particular values

I want to polygonize .tiff raster file for specific values. For example, using one method I firstly reclassified the raster by gdal_calc.py --calc="A*logical_and(A>0,A<1)" then used gdal....
Ermek Ermek's user avatar
3 votes
0 answers
560 views

Non-zero error with ImportFromEPSG() in GDAL/OSR/Python

I'm currently getting an error when testing ImportFromEPSG() on my GDAL. import osr testSR = osr.SpatialReference() testSR.ImportFromEPSG(4326) #this returns value of 6 print testSR.ExportToPrettyWkt(...
dharmabum28's user avatar
3 votes
0 answers
458 views

Django and Osgeo (closed)

I want to use osgeo tools in a virtualenv with Django. I already followed the directions in the Django manual succesfully on different linux systems. But this time I got stuck while intalling GDAL. ...
waterbug's user avatar
3 votes
0 answers
203 views

gdal_translate bilevel tiff output

I have a geotiff image that rings in at about 290MB. However, once I smooth it using a gaussian filter I'm unable to get it back to that size, it ends up being 1720MB. The size isn't really the ...
Marc's user avatar
  • 41
3 votes
0 answers
630 views

Getting "Segmentation fault: 11" with ogr in Python

This is the code I'm trying to run: In [1]: from osgeo import ogr In [2]: datasource = ogr.Open('testdata.shp') In [3]: datasource.GetLayerCount() Out[3]: 1 In [4]: layer = datasource....
juliomalegria's user avatar
2 votes
0 answers
375 views

How to use an affine transformation pipepline with GDAL Python API?

I am trying to transform coordinates from a local grid to a projected coordinate system (UTM) to ultimately reproject raster or vector data. I am using : Python 3.9 GDAL 3.6.0 Pyproj 3.4 I generated ...
user1639843's user avatar
2 votes
0 answers
107 views

Python - same GDAL command giving different results

I've been using GDAL warp to re-project a tiff I have. On the GDAL commandline I use gdalwarp -t_srs EPSG:3857 C:/test/test_file.tif C:/test/test_file_gdal.tif Similarly, I wanted to run this function ...
guest_98732012's user avatar
2 votes
1 answer
403 views

Image is South up while converting NetCDF layer to GTiff with gdal_translate

Issue: I'm trying to extract a NetCDF layer to GeoTIFF. The output GeoTIFF image has the South up. What I need: The output GeoTIFF image with North up. GDAL version: 3.2.2, released 2021/03/05; OS: ...
PDash's user avatar
  • 383
2 votes
0 answers
281 views

Are there any ways to composite Sentinel-2 bands with python?

Sentinel-2 satellite bands have different spacial resolutions, so how can I composite bands of satellite image in python (instead of gdal_merge script)? I tried to stack them by numpy, write each ...
Ivan Novichikhin's user avatar
2 votes
0 answers
319 views

Why do I get value of GDAL GetMaximum() different than that of numpy array max() for same image band?

Here is a code snippet from osgeo import gdal import numpy file = gdal.Open('DEMO.TIF') band = file.GetRasterBand(1) max = band.GetMaximum() if not min or not max: (min,max) = band....
hillsonghimire's user avatar
2 votes
0 answers
44 views

Reprojecting a shapefile Error

I am trying to write a function to reproject a vector file , by taking the original shapefile as input and giving out the name of the reprojected layer . Though when I call this function I get an ...
Thedarknight's user avatar
2 votes
0 answers
59 views

GDAL osgeo for python treating Z dimension differently

I have a space defined by a polyhedral surface, and I would like to check if a point is inside this space, and I would like to do this in python with gdal. After trying the default installation of ...
lozsarson's user avatar
2 votes
0 answers
468 views

different results ogr2ogr command line vs osgeo import ogr with reading osm data

I am trying to read in openstreetmap data (osm.pbf) files into python. Initially, I've always used the ogr2ogr command line approach to convert the data I want from the osm.pbf to a shapefile and then ...
ElcoK's user avatar
  • 91
2 votes
0 answers
424 views

GDAL/OGR Returning wrong reprojected shapefile

I use the script in this link to reproject a shapefile and save it. The target projection is derived from a georeferenced raster. The problem is while the target coordinate system is UTM 33N (epsg: ...
Nikos's user avatar
  • 380
2 votes
0 answers
131 views

NITF Metadata not displaying properly in OSGeo Shell. Works in FWTools

I'm using gdalinfo in the OSGeo Shell to display information on a directory of NITF's. For the majority of the NITF's, gdalinfo is saying the all the corner coordinates are 0, which is incorrect. ...
franchyze923's user avatar
2 votes
0 answers
393 views

GDALINFO not displaying what is in .TFW file

I'm trying to alter the metadata in a Geotiff header via a .tfw file. When I change Pixel Size in the .tfw file, that is reflected in GDALINFO how I would expect. However, when I change the Origin ...
franchyze923's user avatar
2 votes
0 answers
1k views

GRASS Plugin to QGIS error

I am installing QGIS and GRASS as part of an FOSS GIS class I'll be teaching this summer. I used the OsGeo4W installer. This installer has always worked flawlessly for me except on the machines at the ...
Kurt Menke's user avatar
2 votes
0 answers
247 views

VSIMalloc3() and UnifiedSrcDensity mask errors when running gdal_warp in OSGEO4w shell

This is related to gdal.py as part of bat script in windows 7 I am getting ERROR 2: VSIMalloc3(): Out of memory allocating 854522136 bytes. ERROR 2: Out of memory allocating 119813400 bytes ...
GeorgeC's user avatar
  • 8,238
1 vote
1 answer
274 views

Convert KML to GeoTIFF with Python (osgeo.gdal)

I have a KML file provided by a user that looks like: <?xml version="1.0" encoding="utf-8"?> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://...
jclark754's user avatar
  • 111
1 vote
0 answers
92 views

QgsGeometry.fromWkt() seems weirdly slow compared to OSGeo/Shapely

wkt = 'LineString (64763.65372879413189366 5532941.864832429215312, 64811.82167246036988217 5533046.30194362625479698, 64827.02791490274103126 5533082.7359510725364089, 64833.97425112823839299 5533108....
Kalak's user avatar
  • 3,847
1 vote
1 answer
106 views

Using PyQGIS GDAL Driver

I'm Trying to load S-57 chart files into PyQGIS standalone application. using depare = QgsVectorLayer(r"8V8POA02.000|layername=DEPARE","DEPARE","ogr") which returns ...
Christian Land's user avatar
1 vote
0 answers
163 views

Edit pixels in a GeoTIFF while preserving ALL metadata

I'm having an issue where I need to read in a GeoTIFF, modify some pixel values (setting specific locations to the NODATA value), and then overwrite the original GeoTIFF. The trick is I want to ...
Erotemic's user avatar
  • 151
1 vote
0 answers
221 views

Error with TransformPoint(x,y) gdal

from osgeo import gdal,ogr,osr def GetExtent(ds): """ Return list of corner coordinates from a gdal Dataset """ xmin, xpixel, _, ymax, _, ypixel = ds....
s1o's user avatar
  • 11
1 vote
0 answers
4k views

Unable to install osgeo on Ubuntu 20.04

I'm trying to install osgeo both via poetry and pip but I see the same error: Defaulting to user installation because normal site-packages is not writeable Collecting osgeo Downloading osgeo-0.0.1....
MaxDragonheart's user avatar
1 vote
0 answers
2k views

GDAL works at command line but fails to import to Python

I am trying to get GDAL available via Python. The PyPI site for for GDAL states that I need to first download and install GDAL. Per the instructions at PyPI I have downloaded and installed GDAL ...
GBG's user avatar
  • 9,930
1 vote
0 answers
355 views

GDAL - Command Line vs. Spyder (Python) Functionality

I am trying to retrieve information from a GeoTiff using the GDAL API in Python (Spyder). Within Anaconda I have my base environment which contains gdal v2.3.3, but I also created a virtual ...
mdl518's user avatar
  • 165
1 vote
0 answers
610 views

ImportError: No module named osgeo

I'm running a .bat script (included) in the cmd prompt. I get the error "ImportError: No module named osgeo" when it tries to call the gdal_merge.py command. I think this has something to do ...
gpatkinson's user avatar
1 vote
0 answers
73 views

Making a QGIS plugin public for users

I created a Python plugin in QGIS and I want to make it public, so that any user could download and use it I serached in https://plugins.qgis.org/plugins/ , but to upload the plugin , I have to have ...
Namoat's user avatar
  • 307
1 vote
0 answers
268 views

Plotting CDF of the values in a raster (.tif) file, using Python or QGIS?

I have a tiff file with some values and I want to read those values and plot a CDF (Cumulative Distribution Function). So far I only know how to get the mean value from osgeo import gdal gtif = gdal....
rocker996's user avatar
  • 111
1 vote
0 answers
5k views

Installing OSGEO and GDAL in Ubuntu

I'm trying to run a Python program which needs to import from osgeo import gdal, ogr import osgeo.ogr, osgeo.osr from osgeo.gdalconst import * But when I run it outputs Traceback (most recent call ...
rocker996's user avatar
  • 111
1 vote
0 answers
35 views

QGIS library to OSGEO library codes

is there any way to convert the scripts which is produced in QGIS as python scripts from processing modeler to codes using osgeo library codes? i want some codes that can be used in QGIS algorithm in ...
mohamad esmaeeli's user avatar
1 vote
0 answers
591 views

GDAL Open error in C#

I want to open a csv raster data file with GDAL in C# Dataset csvFile = Gdal.Open(fileLocation, Access.GA_ReadOnly); Produce an error saying that At line 4, X is 412267, where as 412555 was ...
AchmadJP's user avatar
  • 111
1 vote
0 answers
221 views

Problem importing qgis.core inside docker container

I'm trying to use QGIS libraries in docker container. When I try import qgis.core I get this error, really I can't figure out what is the cause. Traceback (most recent call last): File "<stdin&...
kgkg's user avatar
  • 171
1 vote
0 answers
726 views

What driver should I use when trying to open a Geospatial PDF with OSGEO and Python?

My code is as follows: from osgeo import ogr from osgeo import gdal dso = ogr.Open('myfile.pdf') print dso dsg = gdal.Open('myfile.pdf') print dsg driverGeoPDFogr = ogr.GetDriverByName('PDF') ...
js1983's user avatar
  • 321
1 vote
0 answers
134 views

How to identify grid shift file used by osgeo in Python?

I wrote a Python script reprojecting points from a source coordinate reference system (SCRS) to a target one (TCRS) both identified by an EPSG code. I would like my python script to retrieve details ...
user1639843's user avatar
1 vote
0 answers
689 views

using GDAL/OGR (faster)

Eventually, I was able to get the GDAL installed and compiled correctly using Visual C++ 2010. I even tested some of its methods on some geo-referenced raster files, and it looks like that all is ...
user2201373's user avatar
0 votes
0 answers
38 views

Hotine Oblique Mercator projection Where is the code in C/C++/Python?

For these functions: SetHOM() Set a Hotine Oblique Mercator projection using azimuth angle. SetHOM2PNO() Set a Hotine Oblique Mercator projection using two points on projection centerline. SetHOMAC() ...
Mario Rossi's user avatar
0 votes
0 answers
48 views

Unable to Install GDAL Python Binding with PIP

I am trying to install GDAL Python Package in my macOS Sonoma(14.4), but each time I am trying to install I get an error which is mentioned below: Few last lines of the Installation Message: /usr/...
Aman Ranjan's user avatar
0 votes
0 answers
34 views

Edited shapes become invisible

I´m working editing shapes in a geodatabase with Osgeo. The last editions become invisible until I make a new edition. The problem is that the last editions become invisible until I make a new ...
Cuerda Florencia's user avatar
0 votes
0 answers
33 views

Specify the driver used to read in a file for gdal.Warp in python osgeo

In base gdal, it is possible to specify the input format driver using -if. How can this be set when calling osgeo.gdal.Warp?
nrp1000's user avatar
  • 447
0 votes
0 answers
100 views

Saving a GeoTIFF with transparent data using OSGeo.Gdal

I'm creating a GeoTIFF using OSGeo.Gdal and have been successful so far. However, it's unclear to me how to save a .tif file with transparency. I'm building the GeoTIFF using a byte array where values ...
tkbadmoon's user avatar
0 votes
0 answers
176 views

AWS Lambda layer in eu-west-2 containing gdal & python-gdal bindings

I need to write a Lambda that uses GDAL. I've tried using https://github.com/developmentseed/geolambda, but I need the layer from eu-west-2 region due to other dependencies. I've tried other Lambda ...
Imran AK's user avatar
0 votes
0 answers
54 views

Warp result of GDAL translate jpg to geotiff using osgeo.gdal

I am attempting to warp a geotiff created from gdal.Translate where the original file was a jpg. I first obtain the ground control points from a co-located text file. The results of gdal.Translate ...
jclark754's user avatar
  • 111