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
2 votes
2 answers
48 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....
user avatar
  • 549
1 vote
0 answers
18 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....
user avatar
  • 11
0 votes
0 answers
484 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....
user avatar
1 vote
1 answer
86 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 ...
user avatar
  • 31
1 vote
1 answer
104 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-...
user avatar
  • 1,687
1 vote
1 answer
30 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 ...
user avatar
  • 1,687
0 votes
0 answers
63 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 ...
user avatar
  • 1,797
1 vote
0 answers
148 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 ...
user avatar
2 votes
1 answer
91 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 ...
user avatar
2 votes
1 answer
117 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 ...
user avatar
  • 431
0 votes
1 answer
76 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?
user avatar
  • 109
0 votes
1 answer
67 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 ...
user avatar
  • 1,687
1 vote
1 answer
56 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 ...
user avatar
  • 1,687
1 vote
1 answer
94 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 ...
user avatar
  • 1,687
1 vote
1 answer
218 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 ...
user avatar
  • 1,687
0 votes
1 answer
29 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
154 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. ...
user avatar
0 votes
0 answers
106 views

How to install/write Esri file geodatabase (*.gdb) in QGIS after QGIS installation on Mac

I have to write some data into *.gdb format in QGIS 3.20. I am aware that since 3.2 QGIS has native support of reading the *.gdb files. However, I have to Export/Save As/ Esri file geodatabase. I've ...
user avatar
  • 119
1 vote
0 answers
535 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 ...
user avatar
  • 7,107
1 vote
1 answer
33 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 ...
user avatar
0 votes
1 answer
123 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 ...
user avatar
0 votes
0 answers
17 views

Rotate Raster at some point

I am trying to rotate the Raster Layer loaded by GDAL plugin. var layer = MainMap.Layers.SelectedLayer as IMapRasterLayer; layer.DataSet.RotateAt(angle, CenterCoordinate); This did not rotate keeping ...
user avatar
  • 189
0 votes
1 answer
153 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: ...
user avatar
  • 343
0 votes
1 answer
78 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 - ...
user avatar
2 votes
0 answers
45 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 ...
user avatar
  • 486
1 vote
1 answer
153 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 ...
user avatar
  • 113
1 vote
3 answers
802 views

Calculating proportion of area that is land within bounding box using Python [duplicate]

I am trying to find the proportion of land in an area specified within a bounding box (in python). The bounding box is given by min/max latitude & longitude coordinates. The initial solution I ...
user avatar
0 votes
1 answer
43 views

Geometry geografic transformation with OGR, OSR - UTM to Degree

I am trying make a geotransformation from UTM coordinates to decimal degree coordinates, but i have only zeros as result... I must be missing something, i already take a lock on other users codes but ...
user avatar
1 vote
1 answer
42 views

ogr export gdb to PostGIS doesn't contain geometry for display in GIS [closed]

I'm currently trying to export a .gdb containing polygons to PostGIS which other users will need to display using any software like QGis or ArcGIS. I'm using ogr fom osgeo to export the GDB to PostGIS ...
user avatar
  • 23
6 votes
2 answers
808 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 ...
user avatar
  • 1,687
1 vote
0 answers
142 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 ...
user avatar
  • 55
2 votes
2 answers
1k views

Setting Config Options for GDAL using Python

I am attempting to invoke the "SetConfigOption" function using the GDAL API to tweak GDAL's default settings to get additional information about GeoTiff. I am specifying the Config Options ...
user avatar
  • 55
1 vote
0 answers
226 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 ...
user avatar
1 vote
1 answer
6k views

Cannot convert float Nan to integer with raster data

I have a script that basically takes a low resolution raster grid and creates elevation band text file for this raster based on a high resolution DEM. The data can be accessed from here. On Conda ...
user avatar
3 votes
2 answers
9k views

ModuleNotFoundError: No module named '_gdal'

I am using Python 3.6 and still having this problem,, although I have tried to uninstall both numpy and GDAL and installed them again in the order numpy then GDAL I am using Windows 10. This was my ...
user avatar
1 vote
1 answer
204 views

Unable to replicate GDAL output

I have a set of GRIB files that are fliped (longitude spans from 0 to 365), and I am using gdal to first transform the data to GeoTIFF, and then warp the gridded data to a standard WGS84 longitude (-...
user avatar
  • 318
1 vote
2 answers
1k views

QGIS 3.10 not recognising projection information from raster created using GDAL

Problem QGIS 3.10 only partly reads projection information from raster file however QGIS 3.4 correctly reads information from same raster file. I thought I had an issue creating the raster – I may ...
user avatar
  • 123
0 votes
2 answers
346 views

Python: cfitsio library not loaded when importing OSGeo library or using GDAL on Mac

I am trying to use the OSGeo library and GDAL Python bindings in a script for Python 3.7.7 on MacOS 10.15.4 Catalina. However, when I try to compile the script, I receive the following error as soon ...
user avatar
  • 101
1 vote
2 answers
430 views

Using gdal2tiles on mac [closed]

I need to create some map illustrated tiles to use in leaflet.js for a small web-app I'm building. So far I've been unable to install and configure the GDAL package to work for me. The things I have ...
user avatar
  • 111
1 vote
1 answer
252 views

OGR/OSR Lon Lat convention

When I project (lon,lat) coordinates I get a different result depending on the version of OGR/OSR. osgeo.version_info sys.version_info(major=3, minor=6, micro=9, releaselevel='final', serial=0) ...
user avatar
1 vote
2 answers
1k views

How can I create contours from GeoTIFF and Python (GDAL, Rasterio, etc?) into shapefile with prj file

I'm using a few reference StackExchange/Overflow posts here - and manual, but not coming up with what I'm after. I have a GeoTIFF that I'm importing, and I need to develop out contours at regular ...
user avatar
  • 240
1 vote
0 answers
50 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 ...
user avatar
  • 179
2 votes
0 answers
151 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 ...
user avatar
2 votes
1 answer
1k views

Read GML using Java

I have a use case on reading and extracting data from GML (Geography Markup Language) using Java. There is a sample file in GitHub by clicking here. The imported packages in Java were as follows ...
user avatar
  • 139
2 votes
0 answers
156 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....
user avatar
5 votes
0 answers
94 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 ...
user avatar
5 votes
1 answer
423 views

Transforming lat/lon coordinates into an undescribed DATUM from NOAA .grib2 files

I seem to be having issues with converting coordinates. I'm currently working in Python v3.7 osgeo (ogr, osr, gdal) I want to find specific values (like temperature, wind, humidity) based on input ...
user avatar
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 ...
user avatar
  • 31
0 votes
1 answer
3k views

Resample raster from one resolution to another with GDAL Python API

i have some trouble warping one raster to different resolution. My input is a one channel tiff with. I know the geo-coordinates of x_min and y_max. I also know that the pixel resolution is 5 meters. I ...
user avatar
1 vote
2 answers
1k views

Transforming raster with gdal.Warp

I am trying to transform a raster with gdal.Warp in my own python script. Example: In the src raster one pixel presents 5 meters and I am trying to transform it where one pixel would present 6,5 ...
user avatar

1
2 3 4 5