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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
48 views

No module named 'osgeo._gdal_array' - Docker image with Python and GDAL

I'm having trouble using GDAL in docker. My application locally but when on docker I get this error: ModuleNotFoundError: No module named 'osgeo._gdal_array' I created here a small example to make ...
DeNasti's user avatar
0 votes
0 answers
51 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
50 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
30 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
1 vote
1 answer
102 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
2 votes
2 answers
84 views

Cannot import QgsVectorLayer from osgeo.ogr

I am trying to write a simple script to convert an ESRI geodatabase to a geopackage using gdal/ogr. Here's the example I was using: from osgeo import ogr fgdb = r"C:\GIS\data\somefilegeodatabase....
gwydion93's user avatar
  • 1,883
0 votes
1 answer
459 views

ModuleNotFoundError: No module named 'matplotlib.backends.backend_qt4agg'

I installed QGIS plug-in "AVHYAS is an open source Python 3 tool plugged in QGIS",and installed required libraries however while trying to use some function, I got the following error. The ...
Mustafa Ustuner's user avatar
1 vote
1 answer
129 views

Python GDAL-OSGEO library: shapefile to PostGIS?

I'm working on a Python script which needs to use the gdal python module, and not the subprocess call method. I've been using this, but I can't find any example or good documentation online about how ...
Theo F's user avatar
  • 1,787
1 vote
0 answers
66 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....
Louis Cottereau's user avatar
2 votes
2 answers
259 views

How to extract geometries with M-values from a feature layer in Python?

Problem statement I am aware that geopandas (due to the limitations of shapely and pygeos) does not read geometries with M-values - when reading a layer that has them, geopandas now just drops those ...
Felipe D.'s user avatar
  • 2,331
0 votes
1 answer
71 views

Creating custom projection centered around chosen point for use with osgeo/geopandas

I'm looking to create a custom projection based upon EPSG:4087 except instead of the center of the projection being lat 0, lon 0 I would like the projection to be centered around a chosen position. ...
user1671538's user avatar
0 votes
1 answer
63 views

Ogr2Ogr appending duplicate records (2X Times) to PostgreSQL Table

I'm synchronizing data from AmigoCloud's table with a PostgreSQL table. I'm using GDAL's ogr2ogr module in osgeo environment. The command I'm running is as follows: ogr2ogr -append -f PostgreSQL PG:&...
RMT's user avatar
  • 39
4 votes
1 answer
399 views

Export list of shapely.geometry.polygons as Esri shapefile

I have a list of shapely polygons, polygons. I want to export them all to an Esri shapefile layer. Here is the first feature in the list of polygons: POLYGON ((484 169, 485 169, 485 170, 486 170, 486 ...
Max Duso's user avatar
  • 155
5 votes
1 answer
4k views

Cannot install gdal or osgeo using .venv - error: legacy-install-failure

I know there are many questions about this issue , hence, I couldn't find working solution yet so I'm trying here as well... I have cloned a git repo which one of the requiremed package there is to ...
ReutKeller's user avatar
  • 2,047
0 votes
0 answers
31 views

In MAPGUIDE using .NET (aspx file) from OSGEO examples for MAPGUIDE, Cyrillic does not work

I did the following: I loaded in CODE WRITER the file - ..\Web\www\dotnetviewersample\findaddress\findaddressmain.aspx I changed:  Find Address Search for an Address Address: ...
Todor Rangelov's user avatar
1 vote
1 answer
75 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
0 votes
0 answers
265 views

Passing additional options to gdal.Translate

I have a vrt file defining a transformation of a raster dataset that I would like to turn into a set of gdal.Warp or gdal.Translate commands: <VRTDataset rasterXSize="100" rasterYSize=&...
Forrest Williams's user avatar
0 votes
0 answers
80 views

Align rasters with Python

I am trying to compare two rasters that overlap in a region but the comparison needs to be done in the whole raster. They don't have a common point but the pixel sizes are not that different. The ...
TheGame's user avatar
  • 47
1 vote
0 answers
117 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
2 votes
0 answers
277 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
0 votes
0 answers
323 views

Importing gdalnumeric from osgeo - Python

I am trying to import the gdalnumeric in order to use the function gdalnumeric.LoadFile(file) but I get the following error: from . import _gdal_array ImportError: DLL load failed while importing ...
TheGame's user avatar
  • 47
0 votes
1 answer
111 views

OSGeo4W command line utilities provoke "Access is Denied" error [closed]

I regularly use OSGeo4W's Advanced Install to update and add packages. I have a Windows 10 Enterprise OS with Administrator rights, and a bunch of OSGeo commandline utilities installed. I installed ...
mbela's user avatar
  • 127
3 votes
0 answers
710 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
2 votes
0 answers
99 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
1 vote
1 answer
65 views

How to read 4d subdataset in osgeo gdal

I'd like to plot an array with the following dimensions: [3x3x180x360] it's a 180x360 world map with 3 different opacity layers and 3 different pressure levels. Thus, I would like to plot the map with ...
Shaun's user avatar
  • 11
0 votes
0 answers
196 views

GDAL errors with conda installation

I installed gdal using conda (Windows) with 'conda create -n pygeo gdal h5py python=3.8'. After activating with conda activate pygeo, and attempting to write out a geotiff using gdal_translate, I get ...
user64841's user avatar
2 votes
3 answers
814 views

OSGeo4W Install from Local Directory seems to expect Win32 applications

I want to install QGIS 3.18 on a PC running Win7-64bits. I have manually downloaded all required files (listed in https://download.osgeo.org/osgeo4w/v1/x86_64/setup.ini) from here: https://download....
YeO's user avatar
  • 579
1 vote
0 answers
188 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
3k 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
2 votes
1 answer
1k views

ogr.CoordinateTransformation appears to be inverting xy coordinates

My problem exists with Polygons, but I created the following as an example using points to simplify my problem. My issue is when transforming geometry from EPSG:26913 to EPSG:4326 the output of x and ...
sneeze's user avatar
  • 61
1 vote
2 answers
1k views

How to convert from OGR geometries (with M-values) to shapely geometries (without M-values)?

Main question Suppose I have a few OGR geometries, all of them containing M-values. Is there a generic solution that allows me to translate them to Shapely geometries without M-values? Shapely and M-...
Felipe D.'s user avatar
  • 2,331
2 votes
1 answer
320 views

Why does OSGEO/OGR add a third dimension to my 2D geometry?

When I instantiate a new wkbPoint geometry and give it only two coordinates, I expect it to be specifically 2D. However, a third coordinate automatically gets added as 0. See my code below: from osgeo ...
Felipe D.'s user avatar
  • 2,331
1 vote
1 answer
243 views

gdal_pansharpen.py raise module errors

I want to use gdal pansharpen python function. I have two tif files, one is the panachromatic raster and on is the 4 bands raster. I'm using gdal version 3.4.0. I have tried to use it, based on this ...
ReutKeller's user avatar
  • 2,047
1 vote
1 answer
655 views

Python code in AWS Lambda to load shapefile to PostgreSQL/PostGIS (RDS)

I am new to GIS implementation. I am trying to develop AWS Lambda code in Python to load shapefile dynamically. I developed the code after doing some research and it is perfectly working on my local ...
Vikas Kumar's user avatar
2 votes
1 answer
163 views

Converting GDAL command line statements to Python

I am trying to carry out the task of sending each row/polygon from a single shapefile to its own unique raster. I so far use GDAL commands through the OSGeo4W Shell like so after navigating to my ...
LostinSpatialAnalysis's user avatar
2 votes
1 answer
263 views

Why does GDAL's 'GetDescription' function return an empty string?

I have used GDAL to add descriptions to my raster band. I have verified in QGIS that the bands are indeed correctly named. I use the following function for adding names as band descriptions, which has ...
Sytze's user avatar
  • 711
1 vote
2 answers
615 views

osgeo/ogr function that smooths geometry/vertex like qgis/processing toolbox/smooth

In QGIS, I want smooth a shapefile/vector's vertices. I can use QGIS/processing_toolbox/smooth. If I want to programmingly achieve this using osgeo/ogr/gdal, which function should I use?
cinqS's user avatar
  • 119
0 votes
1 answer
586 views

Creating LineString geometry from Point geometries with Python's OSGEO/OGR library

Is it possible to create a LineString object with Python's osgeo/ogr library starting from multiple Point objects? For example, I know from the Python GDAL/OGR Cookbook that I can create a ...
Felipe D.'s user avatar
  • 2,331
1 vote
1 answer
327 views

Creating Python OSGEO/OGR geometry with M-values (not using WKT)

I am trying (and failing) to generate M-value geometries (e.g. POINT M, POINT ZM, LINESTRING M, ...) with Python's osgeo/ogr library. Here is what I've tried to far: import ogr # Use OGR specific ...
Felipe D.'s user avatar
  • 2,331
2 votes
1 answer
597 views

How do you preserve the ID field when using the osgeo/ogr/gdal VectorTranslate function in Python?

When using the Python osgeo/gdal/ogr library, how can I force the feature ID column (e.g., "OBJECTID" or "FID" columns) to be preserved in the output file? I thought I would just ...
Felipe D.'s user avatar
  • 2,331
1 vote
1 answer
756 views

How can I use the Python osgeo/ogr library to export a feature layer to CSV with geometries coded as WKT?

How can I read in a layer's data using the python osgeo/ogr library and then export the whole attribute table and an extra column with the geometries coded as WKT to a CSV format? I know that this is ...
Felipe D.'s user avatar
  • 2,331
0 votes
1 answer
279 views

Cannot find GDAL retile

I cannot find GDAL retile Python script. It says the "'gdal_retile.py' is not recognized as an internal or external command, operable program or batch file". Do I have a raster driver down ...
GeorgeStevenJ9272's user avatar
0 votes
2 answers
509 views

Wrong coordinates after converting GML to GeoJSON

I'm using OSGeo.OGR (C#) library to perform GML to GeoJson conversion. Parsing works perfect except extracting incorrect coordinates. After conversion map objects appears in another place on the map. ...
Javid Gahramanov's user avatar
1 vote
0 answers
1k 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,404
1 vote
1 answer
193 views

gdal.Warp produces black stripe

I have a TIFF file which looks like this: Now I want to change the resolution by gdal.Warp. The script is the following: gdal.Warp('output.tif', 'input.tif', xRes=0.7, yRes=0.7) And the ...
Марина Лисниченко's user avatar
0 votes
1 answer
289 views

Issue when reprojecting shapefile using OSGEO in Python: prj file missing and kernel restart

I tried to reproject a shapefile based on the projection of a raster file following this example (section "Reproject a Layer"). My code is as follows: # open the raster tif and extract ...
Manuel Popp's user avatar
2 votes
1 answer
359 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
  • 363
0 votes
1 answer
123 views

Sen2Like GDALRasterizeOptions Failed to process SRS definition

While running sen2like tool in single-tile-mode an error related to osgeo gdal occurred (Python): [INFO ] 2021-04-07 13:01:06 - reader - Sentinel2MTL Class [INFO ] 2021-04-07 13:01:06 - reader - ...
Alessandro Saporato's user avatar
3 votes
0 answers
118 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
1 vote
1 answer
409 views

Reconstruct full coordinate reference system stored in a GML file

I have been able to parse a GML file and fetch the polygons I wanted. They can be plotted ok when plotted on their own. I have them stored in a GeoPandas data frame, but I am struggling to set the ...
Rho Phi's user avatar
  • 113

1
2 3 4 5