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.

Filter by
Sorted by
Tagged with
1 vote
1 answer
67 views

MultiPolygon to Polygon in Python [closed]

I need to change geotype from MultiPolygon to Polygon. Most of the original features are Polygon, but are automatically imported through API as MultiPolygon. How can I change all the types ...
Ilya's user avatar
  • 13
0 votes
1 answer
39 views

Transforming ortho (.tiff) file from one epsg to other epsg

I am using GDAL to transfrom ortho from one EPSG to other EPSG. In my case I have used EPSG:32610 which is in (m) and transformed into EPSG:2227 which is in (us-ft). I am able to transform it using ...
Vivek Rao's user avatar
3 votes
2 answers
151 views

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

Main question Using OGR in Python, how can I extract the integer-based geometry type code for a specific feature? I know how to do this when dealing with a whole layer. For example, reading a layer ...
Felipe D.'s user avatar
  • 2,689
0 votes
0 answers
44 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
87 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
1 answer
73 views

Modify a subset of a raster based on a shapefile

I want to modify a subset of a raster based on the extent of a shapefile. The raster is of ground elevations and I need to modify an area that has been excavate into a big hole by subtracting 200 m. I ...
Em_kath_white's user avatar
0 votes
0 answers
35 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
45 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
1 answer
401 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
120 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
193 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
55 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
323 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
110 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,913
0 votes
1 answer
2k 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
323 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,839
1 vote
0 answers
95 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,880
2 votes
3 answers
486 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,689
0 votes
1 answer
176 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
95 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
880 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
  • 153
6 votes
3 answers
7k views

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

I have cloned a git repo which one of the required package there is to have gdal installed. The computer is Linux and I use vs code to connect reomtly. at the beginning I naively tried to install gdal ...
ReutKeller's user avatar
  • 2,169
1 vote
1 answer
109 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
91 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
181 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
400 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
428 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
134 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
804 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
109 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
90 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
218 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
1k 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
  • 609
1 vote
0 answers
236 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
2 votes
1 answer
2k 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,689
2 votes
1 answer
489 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,689
1 vote
1 answer
311 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,169
1 vote
1 answer
774 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
185 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
333 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
  • 771
1 vote
2 answers
796 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
773 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,689
1 vote
1 answer
459 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,689
2 votes
1 answer
739 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,689
1 vote
1 answer
869 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,689
0 votes
1 answer
369 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 ...
user avatar
0 votes
2 answers
576 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's user avatar
  • 3
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
  • 10k

1
2 3 4 5