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.
240
questions
2
votes
0
answers
106
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 ...
2
votes
3
answers
969
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....
1
vote
1
answer
79
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 ...
0
votes
0
answers
211
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 ...
0
votes
1
answer
111
views
Determining Appropriate DBDB-V Subdataset
I am using DBDB-V v6.2 and GDAL, specifically the dbdbv6_level0c.h5 HDF5 file and the GDAL 2.3.3 C# binaries.
Using these lines of code I can easily find the full list of Subdatasets used in the ...
6
votes
1
answer
3k
views
"ImportError: No module named qgis.core" when importing qgis.core in Python
I installed OSGeo4W. I have no other Python version on my computer.
I can import osgeo. But when I try to import qgis.core I am getting the error:
>>> import qgis.core
Traceback (most recent ...
1
vote
0
answers
217
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....
8
votes
6
answers
57k
views
Installing Python-GDAL with OSGEO?
I have been trying to install python gdal with OSGEO for some time now with no success. I have removed. I have tried with "Express and Advance" as suggested by OSGEO4W site.
The error is always "No ...
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....
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 ...
2
votes
1
answer
430
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 ...
0
votes
1
answer
707
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 ...
2
votes
1
answer
308
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 ...
2
votes
1
answer
170
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 ...
1
vote
2
answers
788
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 ...
19
votes
2
answers
15k
views
Adding custom feature attributes to shapefile using OGR in Python
I am seeking a way to take an existing Shapefile that has a Feature set of 200 countries. Each country Feature has an attribute of "NAME." My objective is to create a Python script that adds an ...
3
votes
2
answers
3k
views
SetColorInterpretation() for a GeoTiff using GDAL not working
I have a single band image which I would like to copy to a 3 bands of a new image and set the ColorInterpretation to red, green and blue respectively. I have tried two approaches, one using the GTiff ...
1
vote
1
answer
414
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 ...
2
votes
1
answer
689
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 ...
1
vote
1
answer
829
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 ...
0
votes
2
answers
549
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. ...
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 ...
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 ...
1
vote
1
answer
199
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 ...
0
votes
1
answer
327
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 ...
0
votes
1
answer
128
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 - ...
5
votes
3
answers
1k
views
How to extract FileGDB's domains without ArcGIS?
I'm trying to get an ESRI File Geodatabase domains by using the GDAL\OGR library. By doing so, I wish to edit this datasource using QGIS' Attributes Form with designated value map widgets that point ...
4
votes
5
answers
5k
views
Get srid from a shapefile using ogr
I'm writing a script to import shp to postgis,
using python, osgeo and psycopg2
( see my previous question:
Import shp to Postgis using Python and ogr )
I'd know if there is a way to get by osgeo ...
5
votes
1
answer
833
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 ...
1
vote
1
answer
452
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 ...
1
vote
3
answers
1k
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 ...
0
votes
1
answer
146
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 ...
1
vote
1
answer
317
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 (-...
1
vote
1
answer
186
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 ...
1
vote
0
answers
351
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 ...
3
votes
2
answers
4k
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 ...
1
vote
0
answers
593
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 ...
2
votes
1
answer
10k
views
installing gdal from osgeo to work with GeoTIFF
I just installed Anaconda Navigator (and nothing else) in Windows and want to be able to work with GeoTIFF files in
Spider (Python 3.7).
It is my understanding that Navigator can search for packages ...
3
votes
1
answer
797
views
gdalwarp '-tps' equilvalent in C# wrapper?
I am attempting to do the following from code:
gdal_translate.exe --config GDAL_DATA "D:\gdal\bin\gdal-data" -of GTiff -a_srs EPSG:4326 -gcp 0 0 -108.724530873811 40.1376029956585 ..<...
4
votes
2
answers
21k
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 ...
1
vote
2
answers
2k
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 ...
1
vote
1
answer
262
views
Resampling two raster files
I have two rasters, one for road network and another one for the DEM of the country.
I have to overlay the road network raster on top of DEM raster so as to get the elevation of roads. But my rasters ...
4
votes
3
answers
23k
views
Python 3.6 error import osgeo
I'm trying to install GDAL osgeo lib into Python 3.6 on Debian Stretch
I installed neccessary packages like:
sudo apt-get update && sudo apt-get install -y \
binutils \
libproj-dev \
...
0
votes
2
answers
558
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 ...
1
vote
1
answer
659
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)
...
2
votes
2
answers
3k
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 ...
11
votes
1
answer
4k
views
Differences between OSGEO GDAL and GDAL python bindings?
Question
I'm trying to figure what are the differences, and of course, what is the best solution to use, between two python3 bindings:
GDAL, imported as import gdal
OSGEO.GDAL, imported as ...
2
votes
1
answer
3k
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
...
4
votes
1
answer
2k
views
GDAL conda install on Mac OS trouble
I'm trying to install gdal on my new computer in the anaconda environment using conda but having issues. All I've done so far is install Anaconda for python 3.6 and install gdal as described here + a ...
5
votes
2
answers
5k
views
Reading a shapefile as an array using Python?
I am trying to read a shapefile as an array with Python but I keep getting the same error:
Warning 1: Failed to find field ID on layer shapefile_maido_tipe, skipping.
ERROR 4: `temp.tif' not ...