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
1answer
591 views

Saving MultiLineString to Shapefile and KML/KMZ with Python [closed]

What is the fastest way to save MultiLineString to Shapefile (without attributes) and KML/KMZ? Preferred open-source libraries like fiona, shapely etc. from osgeo import ogr multiline = ogr.Geometry(...
4
votes
0answers
722 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/...
2
votes
1answer
724 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 ...
0
votes
1answer
793 views

Module has no attribute Warp?

I'm using GDAL v2.14 on my Windows 10 machine. In that environment, I have two gdal python bindings. One is import gdal, the other is import osgeo. I installed Python's gdal using http://www.lfd.uci....
6
votes
2answers
528 views

Overlapping Polygon becoming hole when converting geojson to shapefile

I'm trying to convert a geojson MultiPolygon which contains two overlapping polygons to a shapefile, however I noticed that the resulting shape has a smaller area. Upon inspection it's because the ...
8
votes
1answer
3k views

Crop a raster using rasterio and geopandas

I am cropping a set of historic aerial photographs. These photographs have large black areas in the edges (0 value). However there is also valid data with a 0 value. The workflow I am using is: Load ...
1
vote
5answers
4k views

GDAL/OGR Geometry Type Python

Taking a long shot but does anyone have an idea of whether GDAL or OGR has a function to determine a shapefile or layer geometry type using python? I specifically want the output to print "POINT" for ...
3
votes
1answer
138 views

Line network segment length

I am looking for a way to calculate the segment lengths of a line network. I am probably missing just the right vocabulary to search for the best approach, so I guess asking here would be a good idea. ...
1
vote
1answer
497 views

ogr2ogr add geometry from x y when importing to postgis

Im importing a xlsx with x y coordinates to a postgis database, with the following command: ogr2ogr -overwrite -progress -nln data -nlt POINT -f PostgreSQL "PG:host=Localhost user=postgres password=...
2
votes
1answer
528 views

Dissolve ogr geometries in Python [closed]

I parse a geoJson file resulting in a list of osgeo.ogr.geometry-classes (all Polygons). I also have a new one which I want to dissolve with the rest. I'm using the ogr package in python, it does ...
1
vote
0answers
91 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. ...
2
votes
0answers
190 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 ...
2
votes
1answer
385 views

Use Python binding of osgeo - Union two linestring layers into one

I am using the Python GDAL/OGR bindings. I have two linestring shapefile layers. They are the census TIGER streets and a new set of line segments that represent lines connecting census block ...
4
votes
2answers
2k 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 ...
3
votes
2answers
12k 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 ...
3
votes
1answer
818 views

QGIS 2.18 Couldn't Load QGIS Utils

I ran into an issue and had to reinstall QGIS 2.18, but I can't seem to get it to properly work though. Whenever I install it it says "QGIS 2.18 is already installed on your computer..." even though I ...
12
votes
3answers
19k views

No module named 'osgeo'

I have installed GDAL and checked on the command line, it is working and when I run the gdal2tiles.py on the command line it works but when I run the same file gdal2tiles.py with python IDLE, I get "...
-3
votes
1answer
2k views

Plot a surface with a DEM and mplot3d [closed]

I want to plot a surface on Python with a DEM that I made on QGIS. I found 2 posts on this topic which were published by the same person: GIS Stackexchange: on this post they show us how to obtain a ...
5
votes
1answer
2k views

Running script over every file in folder using GDAL in Python?

I'm using GDAL to calculate NDVI mean and max and to find other information about .tif Landsat images acquired from Earth Explorer. I stacked the bands into a single .tif image and have a working ...
0
votes
2answers
5k views

Why does my script return 'NoneType'?

I have this script and It return me some problem that I didn't find. from osgeo import ogr import os class checkVectorMCV: def __init__(self, vector_path): self.vector_path = os.path....
1
vote
0answers
317 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 ...
1
vote
0answers
135 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&...
2
votes
1answer
1k views

How to save json returned by gdalinfo in python variable

When I run the command in osgeo4W shell gdalinfo -json C:\Users\Gurminder\Documents\Git\Dump\s1a-ew-grd-hh-20160725t043517-20160725t043617-012300-01322b-001.tiff I get a large json of my Ground ...
1
vote
1answer
2k views

Clipping GeoTIFF file by GeoJSON?

Input GeoJSON file: { "type": "Feature", "properties": { "id": 1 }, "geometry": { "type": "Multipolygon", "coordinates": [[[ [27.397511483867362, 44.161117466010516], [...
5
votes
1answer
3k views

GDAL Python cut geotiff image

I was stuck for 2 or 3 days. I have read many lectures from RS/GIS Laboratory of Utah State University. Also I read «Python Geospatial Development» book and many docs from gdal.org. So, my problem ...
2
votes
1answer
334 views

AttributeError: 'SpatialReference' object has no attribute 'ImportFromESPG'

I am trying to create a spatial reference using ImportFromESPG and this is what is returned: AttributeError: 'SpatialReference' object has not attribute 'ImportFromESPG' Code and error are copied ...
3
votes
0answers
184 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(...
1
vote
1answer
53 views

AttributeError: SyncToDisk?

I want to save my 'feat' - selected by criteria polygons in shp.file to save in diferent shp.file on the disk by using SyncToDisk() in osgeo for vector. Code gives me error: AttributeError:...
3
votes
1answer
332 views

Why is the first element of my WFS layer None instead of a feature?

I have made a WFS connection and got a layer from it. I want to use the first feature from that layer. driver = ogr.GetDriverByName("WFS") wfs_url = "WFS:http://example.com/wfs" wfs = driver.Open(...
3
votes
0answers
416 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. ...
0
votes
0answers
51 views

OGR_LINK_FIELD to filename in a Geospatial PDF

I'm using gdal_translate to create a Geospatial PDF. I'm trying to add file path to my feature when clicking on them by using: -co OGR_LINK_FIELD=<column with path> I am creating my PDF in ...
5
votes
1answer
6k views

Need File Geodatabase (*.gdb) read/write support in QGIS?

I have followed the instructions shown in this thread but still don't have the ESRI FileGDB option only the Open File GDB. In my case, I am in the most current QGIS version - Lyon (2.12.0). OSGeo4w ...
19
votes
2answers
20k views

What is OSGeo4W?

I have been using GIS for a few years now (ArcGIS and MapInfo). But only when I have started using QGIS I come across OSGeo4W, as there is an option to download it on the QGIS website. I have tried ...
0
votes
0answers
128 views

Old MIller projections Bipolar Oblique Conic Conformal/Oblated Stereographic definitions?

I'm attempting to georeference and warp some old toposheets that are various old projections including the following: Miller Oblated Stereographic Projection Bipolar Oblique Conic Conformal What's ...
3
votes
0answers
109 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 ...
1
vote
2answers
658 views

I cannot find osr after installing OSGeo4W package

I wanted to be able to import OSR from GDAL on my Python 2.7 (Anaconda) Windows 7 64-bit. I installed OSGeo4W after reading this post and eventually I'd like to import osr from osgeo import osr ...
0
votes
0answers
72 views

Installing GDAL Python bindings on Windows [duplicate]

This has been addressed before (Installing GDAL with Python on windows?), but I wanted to bring the question up again, to see if anybody has come up with a better method in the last 5 years, and to ...
1
vote
0answers
467 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') ...
2
votes
4answers
9k views

GetRasterBand() method for gdal in Python

I was going through a tutorial book called Python Geospatial Development. On the chapter on using working with geospatial data in python there is an example of a script meant to handle and analysis ...
0
votes
1answer
4k views

Converting JSON to GeoJSON MultiPoint using `ogr.CreateGeometryFromJSON`

I am trying to convert a JSON array to a geom in Python, by first converting it to a GeoJSON. I have point coordinates in a JSON array, [{'lat':100.0, 'lng':0.0},{'lat':101.0, 'lng':1.0'}] that I ...
8
votes
1answer
9k views

How do I install the GDAL bindings for C#/.NET 4.5.1?

I'm trying to use the C# gdal bindings but I get an error in my C# code which says "Unable to load DLL 'gdal_wrap': The specified module could not be found. (Exception from HRESULT: 0x8007007E)". I'...
5
votes
2answers
2k views

How do a transform a geotiff image to use the projection of another image?

I have two sets of glib2 data from different sources which I would like to process together. Each image has a different projection and resolution (I don't know if resolution is the correct word to ...
3
votes
2answers
630 views

Find unit of EPSG-Code

I need a way to find out the unit of an EPSG-Code (e.g: meter) from java (ogr, gdal, osgeo?) but any other approach would be fine as well. I want to do something like: if(epsg.unit==meter){ do ...
1
vote
1answer
1k views

Using gdal-java of OSGeo4W

I would like to use gdal_polygonize and gdalinfo in java. This site says: "Note that OSGeo4W includes a gdal-java package and a Java runtime making it fairly easily to build local Java applications ...
2
votes
1answer
1k views

Run OTB commands in OSGeo4W Shell scripts

I am trying to run shell scripts with Orfeo-toolbox commands, and I'm new to all this.... (I'm working in Windows 7). I can type otbcli_ComputeImagesStatistics -il Imagery/P1_10cm1.tif Imagery/...
1
vote
1answer
280 views

Invoke OSGeo4W commands with Java

I want to use the command gdal_polygonize image.png bla in a Java for-loop, where image.png and bla changes in every iteration. How can I do this? I searched for it on google and stackexchange and I ...
3
votes
1answer
939 views

problem transforming CRS coordinates EPSG:4269 to EPSG:3857 in python

source_srs = get_srs(shp_abs_path) source_epsg = source_srs.GetAttrValue("PROJCS|GEOGCS|AUTHORITY", 1) print source_epsg #prints 4269 target_epsg = 3857 # because these are headed to leafletjs ...
2
votes
1answer
508 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 ..<truncated>....
1
vote
1answer
1k views

Importing OGR from OSGEO Issues

I am trying to run: from osgeo import ogr and I get: Traceback (most recent call last): File "", line 1, in from osgeo import ogr File "C:\Python27\ArcGIS10.2\lib\site-packages\...
1
vote
1answer
243 views

How can I efficiently use a list comprehension on an ogr.layer inside a loop in Python?

Problem statement I'm using python 2.7 and ogr 1.11.0 on Windows 7. I have two shapefiles: one for streets and one for junctions. The streets shapefile has fields listing the IDs of the start and ...