Linked Questions
13 questions linked to/from Using ogr2ogr to convert GML to shapefile in Python?
7
votes
1
answer
20k
views
How do I use ogr2ogr with python GDAL? [duplicate]
I've just installed GDAL, but I don't know how to import/use ogr2ogr.
I've tried:
from osgeo import gdal
from osgeo import ogr
and searched both for ogr2ogr, but it wasn't there.
10
votes
4
answers
6k
views
How to make crs transformation of a QgsVectorLayer?
I need to transform QgsVectorLayers in python from one crs into another crs. By googling I found the following solution (https://qgis.readthedocs.org/en/latest/docs/pyqgis_developer_cookbook/05_crs....
4
votes
1
answer
6k
views
Merge all features in polygon shapefile with gdal
How do I apply using this same concept, but simply merging all features into one?
ogr2ogr output.shp input.shp -dialect sqlite -sql
"SELECT ST_Union(geometry), dissolve_field FROM input GROUP BY ...
4
votes
2
answers
11k
views
Python library for KML to GeoJSON?
I am writing a Python script to reproject a KML file to WGS 84 and then to convert it to a GeoJSON. I am aware of and use the GDAL command line tool ogr2ogr (which was the answer to this question in ...
2
votes
1
answer
2k
views
Sentinel-2 cloud mask with fmask
I'm trying to run fmask on a Sentinel-2 granule.
I downloaded the 3.2 version of Windows stand alone software for Sentinel 2 from https://github.com/prs021/fmask
When I try to run fmask by calling the ...
3
votes
1
answer
1k
views
Issue to convert from PostgreSQL input to GPKG using Python GDAL API function gdal.VectorTranslate
When I run the following code, it fails with message
The error is ERROR 1: SELECT from table mytable failed, no such table/featureclass.
from osgeo import gdal
gdal.UseExceptions()
gdal....
1
vote
3
answers
2k
views
Cropping a Shapefile into a Rectangular Box with Python pyshp
Using 'pyshp' I am hoping to reduce the set of US highway shapefiles to only those in Puerto Rico. The idea is very easy since I only need those pieces which fit into the window.
>> import ...
2
votes
2
answers
1k
views
Plotting Storm Prediction Center (SPC) Shapefile using Python?
I am trying to make a plot of the SPC's thunderstorm outlook using Python. I have downloaded the shapefile from this website http://www.spc.noaa.gov/products/outlook/day1otlk.html. Then I use this ...
2
votes
1
answer
1k
views
Unable to open datasource with ogr2ogr.main() [closed]
I try to make ogr2ogr work in Python the way suggested by Elevine's answer elsewhere, but I'm facing bugs. Most notable error is that while I try to reproject shapefiles, I get the following error:
...
3
votes
2
answers
882
views
Using ogr2ogr in Python scripts
I have been trying to figure out how to execute ogr2ogr to convert files in Python script. I got it to work in Jupyter notebook within ArcGIS Pro and in the terminal but not in Python scripts. Here's ...
2
votes
1
answer
1k
views
GML file converted to ESRI shapefile with ogr2ogr missing spatial reference information
I am trying to convert Sentinel-2 cloud masks from GML format to ESRI shapefiles. I have managed to use ogr2ogr in a python script as described in the answer to Using ogr2ogr to convert GML to ...
2
votes
0
answers
454
views
Using ogr2ogr in python?
I found this helpful post that got me started using ogr2ogr in python: Using ogr2ogr to convert GML to shapefile in Python? as well as this one: Converting ArcGIS Server JSON to GeoJSON? I am trying ...
2
votes
1
answer
91
views
KML driver failed to create
I want to convert spatial data from postgres to some basic formats (shp, geopackage, csv, xlsx, gml... ) using python gdal functionality. I read the answer to this question: Using ogr2ogr to convert ...