Skip to main content

Questions tagged [ogr]

The OGR Simple Features Library is a C++ open source library (and command line tools) providing access to vector file formats.

Filter by
Sorted by
Tagged with
0 votes
0 answers
34 views

Using FileGDB driver in Google Colab [closed]

I want to use FileGDB driver in Google Colab. I have installed GDAL in the environment but I can't use FileGDB driver. Are there any guides on that?
Amir Baniasadi's user avatar
0 votes
0 answers
15 views

gdal ogr transform c++ swaps axis order x to y [duplicate]

This is example #include "gdal/gdal.h" #include "gdal/ogr_spatialref.h" #include <iostream> void TransformBounds(double xmin, double ymin, double xmax, double ymax, ...
Vignesh M's user avatar
3 votes
1 answer
36 views

Is it possible to get features by the WFS vector driver in a coordinate system that is not the default srs regarding the WFS capabilities?

We currently experiment with the gdal java bindings to receive data from a WFS service. Regarding the WFS specification a FeatureType must define its default coordinate system (Tag DefaultCRS). We ...
Alexander Schlottmann's user avatar
2 votes
1 answer
49 views

Error in dissolving shapefile with ogr2ogr

I am trying to dissolve a shapefile having polygon geometries. I want to dissolve the shapefile which will create a single multi-polygon geometry. ogr2ogr -dialect sqlite -sql SELECT ST_Union(geometry)...
Badal's user avatar
  • 329
1 vote
1 answer
28 views

Writing to FlatGeoBuf using Python OGR results in "ERROR 1: ICreateFeature: Mismatched geometry type"

When I try to create even very basic point geometries using OGR's FlatGeoBuf driver in Python, I keep getting this error: "ERROR 1: ICreateFeature: Mismatched geometry type" Here is a ...
Eoin's user avatar
  • 303
2 votes
1 answer
52 views

Specify layer when using a geopackage in ogr2ogr

I want to clip a vector-layer by another layer with ogr2ogr as explained here. I always struggle to find out how to refer to a layer in ogr2ogr for input and output. Does anyone have a quick tip?
Lenn's user avatar
  • 1,297
0 votes
1 answer
32 views

Read only the structure of a geopackage using GDAL/OGR?

I'm trying to figure out if it's possible to only show the structure (layer names, field names and types, constraints, etc) of a GeoPackage which has no data record using GDAL/OGR (ogrinfo). Is it ...
swiss_knight's user avatar
  • 10.4k
0 votes
0 answers
34 views

MaxRev.Gdal.Core - OSGeo.OGR driver.createdatasource fails with System.NullReferenceException

I try to create a new GeoPackage file and write some point data into it. But my code already fails, when I try to create the new GeoPackage file. I try to create this file within an unix/C# ...
Marcel Gangwisch's user avatar
3 votes
2 answers
140 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,649
2 votes
2 answers
63 views

How to set a 'dataset open option' in ogr on a file geodatabase?

In the documentation for the GDAL/OGR OpenFileGDB driver, there is a Dataset open option called LIST_ALL_TABLES. Using python, how exactly do I set that?
EvanT's user avatar
  • 103
3 votes
2 answers
47 views

Let ogr/GDAL automatically choose Driver based on file extension

I inherited some code for a QGIS Python plugin which uses the ogr module. For each usage of ESRI Shapefiles is hardcoded due to the loading of the respective driver (ogr.GetDriverByName("ESRI ...
Honeybear's user avatar
  • 2,464
1 vote
0 answers
59 views

How to combine ODA File Converter with OGR (GDAL) so that dwg is a format option

I have downloaded ogr/gdal with QGIS 3.34.1 and I have downloaded the ODA file converter from https://www.opendesign.com/guestfiles/oda_file_converter However, I am not sure how to combine the two so ...
guest_231213's user avatar
1 vote
1 answer
49 views

How to assign a layer to a group in GDB datasets using gdal python

I'm currently working with ESRI GDB datasets and I can easily open hierarchical geodatabases and walk the tree using the API that gdal provides. root_group = ds.GetRootGroup() for g in root_group....
Alireza S.N's user avatar
0 votes
1 answer
38 views

ogr2ogr -where: match features from OSM PBF with unset "seasonal" field

I have an .osm.pbf file from Geofabrik and want to extract all lakes that are not seasonal or intermittent to an SHP file, using ogr2ogr. I am currently using the following command: ogr2ogr -where &...
TheEagle's user avatar
  • 115
1 vote
1 answer
82 views

GDAL add custom fields to GPX files using the command line (batch)

Using the GDAL/OGR command line, how could one add some fields to a GPX file ? I simply need to add the gpx filename to its content, e.g. in a new field called datasource in each (there are several ...
swiss_knight's user avatar
  • 10.4k
0 votes
0 answers
23 views

Ogr AddPointZM does not work. Cannot create any geometry with ZM values

I am trying to create LineStringZM using ogr java bindings. My code is below: private Geometry prepareLineString(Layer ly) { var result = new Geometry(ogr.wkbLineStringZM); for (int i = 0; i ...
Michael's user avatar
1 vote
0 answers
78 views

How to extract layers from a mpkx file?

I would like to use the World Terrestrial Ecosystems data published by the USGS. It is made available in the form of a compressed file in the mpkx format. I expect this file to contain one or more ...
Luís de Sousa's user avatar
0 votes
0 answers
37 views

Exporting records with more than 250 characters in a field to GML

I am trying to export OSM vectors to the GML format like: v.out.ogr input=network output=network.gml format=GML I get an error that the field a_other_tags has more than 250 characters: ERROR 1: ...
Jeshua Lacock's user avatar
1 vote
0 answers
57 views

OGR_STYLE label style line breaks

I am trying to create a GeoSpatial PDF using gdal_translate. Using the vrt file i am able to generate OGRFeatures having STYLE OGRFeature():23 OGR_STYLE (String) = SYMBOL(id:"icn_cabinet_external....
Mandeep's user avatar
  • 11
0 votes
0 answers
155 views

Read KML file with GDAL/OGR and access all its attributes

I have a KML file and I'm trying to access a specific attribute named "styleUrl". A feature of this KML looks like this: <Placemark> <name/> <styleUrl>BoundaryStyle</...
Jérémy O.'s user avatar
0 votes
0 answers
41 views

Python OGR error when intesecting line by polygon

When I try to find the intersection of a line gdb layer with a polygon layer I get the following error: Can only insert a LineString/MultiLineString/CircularString/CompoundCurve/MultiCurve in a ...
Robert Thomas Almodovar's user avatar
1 vote
1 answer
63 views

Does GDAL have an error with calling multiple functions on the same line of code?

I typed this code on Python interpreter but the Python shell restart on the last line: from osgeo import ogr shp_ds = ogr.Open(r'C:/Users/admin/countries.shp') lyr = shp_ds.GetLayer(0) #python shell ...
Duststar's user avatar
0 votes
1 answer
125 views

Python OGR: NoneType Error only when writing to OpenFileGDB, reading works fine

I have a peculiar situation when trying to write to a .gdb using OGR. I get a NoneType error following any OGR function after ogr.Open() when I specify the data source as writable. From previous ...
Airv's user avatar
  • 3
1 vote
1 answer
213 views

Converting DXF to shapefile with custom attributes (color)

I am trying to convert .dxf to .shp with passing color attribute to entities in .shp. When using ogrinfo -al test.dxf I can see colors for line and text features: OGRFeature(entities):13 Layer (...
desese's user avatar
  • 11
0 votes
2 answers
332 views

ogr2ogr cannot open datasource ogrinfo can open

I've got a random .osm.pbf from Geofabrik which I'm trying to extract a small region of: $ ogr2ogr -f OSM -spat 7 48 8 49 data/osm/extract.osm.pbf data/osm/germany-latest.osm.pbf ERROR 1: OSM driver ...
TheEagle's user avatar
  • 115
2 votes
1 answer
363 views

In QGIS Georeferencer: Mysterious OGR Driver Error: not found OGR

I have been georeferencing Vector files (gpkg and shp) in the new Georeferencer in QGIS 3.30.1. The files are pretty large, have multiple million features and a size of roughly 2-3gb. I have ...
David SSS's user avatar
0 votes
2 answers
132 views

Exporting polygon as DXF using PyQGIS

I am working on a script to export my dissolved polygon into Dxf but I get an error. Could somebody teach me how to do this? Here is my code: from qgis import processing from datetime import datetime, ...
PyCher's user avatar
  • 171
2 votes
1 answer
209 views

WFS in PostGIS OGR FDW results in "ERROR 1: No schema information loaded."

I am trying to add the WFS data of a german state to PostGIS using the PostgreSQL OGR Foreign Data Wrapper: CREATE SERVER server_mv FOREIGN DATA WRAPPER ogr_fdw OPTIONS ( datasource 'WFS:https://www....
bugmenot123's user avatar
  • 10.9k
0 votes
0 answers
94 views

Working with NHDPlus data in GDB file format using GeoPandas

I am trying to work with the NHDPlus High Resolution dataset from the USGS. Looking at the documentation, there should be all sorts of data table available as well as mapping layers but the only thing ...
Wesley Young's user avatar
2 votes
3 answers
468 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,649
2 votes
0 answers
305 views

How to create Block References in dxf files using GDAL?

I need to use GDAL to create dxf files in AutoCAD. I have already implemented the creation of point-line geometry layers and label layers, but now the creation of Block References keeps failing. In ...
DXnima's user avatar
  • 21
0 votes
1 answer
91 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
1 vote
0 answers
50 views

Using Python OGR to reproject SQL Spatial Data

I currently have a heap of GDAL scripts that reproject from one SQL feature class into a new SQL feature class, but I want to convert these into Python scripts using the GDAL library, to clean up my ...
Joshua J Geoghegan's user avatar
2 votes
1 answer
63 views

ogrinfo / ogr2ogr : sql values with accents

I'm trying to access data that is stored in a MSSQL spatial database and it seems to me that OGR is having some problems with accents. I'm not sure if maybe there is an encoding parameter or something ...
mikibok's user avatar
  • 47
0 votes
0 answers
63 views

Create shapefiles with GDAL and Android studio Warning error on shapefiles created in projection WGS_1984_UTM_Zone_18S

This is my method that creates the shapefile, but the file gets a warning when opened in ArcMap: The added layers have an extension that is not consistent with the associated spatial reference ...
Liber Peña Panduro's user avatar
0 votes
0 answers
23 views

Attribute fields exporting as org_name, I want it to stay as the original field name [closed]

I am exporting a QGIS map as a gpx file, and some of the attribute table fields I have added are turning into ogr_name or ogr_length etc. I need it to stay as the regular field name as I have to ...
Cas's user avatar
  • 1
1 vote
0 answers
181 views

Create DXF file with ogr2ogr, that is visualized in AutoCAD

with ogr2ogr I try to create a DXF file, that is labeled and visualized in AutoCAD directly. What I did to visualize point objects: ogr2ogr --config GDAL_DATA "X:\OSGeo4W64\share\gdal" -f &...
Kai Behncke's user avatar
0 votes
0 answers
199 views

When ogr2ogr hits rasters in a file geodatabase

I would like to use ogr2ogr.py to batch convert feature classes and tables in a collection of ESRI file geodatabases into geopackages, but some of these gdbs have rasters in them, apparently in SDE ...
EvanT's user avatar
  • 103
0 votes
1 answer
197 views

Incorrect coordinate translation using GDAL.NET compared to gdaltransform and epsg.io

I am working on a project to convert between one coordinate system, provided by an EPSG code, and EPSG:4326 or EPSG:4979 (WGS84 CS to include heights above ellipsoid). Testing the following ...
TJames's user avatar
  • 29
0 votes
0 answers
675 views

GeoPandas fails silently when reading GeoJSONs

I have a file example.geojson. This file has 68 features (jq '.features | length' example.geojson returns 68). If I try to load this file to a GeoPandas dataframe (gpd.read_file docs), I can choose ...
zabop's user avatar
  • 2,214
0 votes
0 answers
28 views

Intersection between shapefiles using gdal [duplicate]

From three .tif files I got the relative associated .shp files through gdaltindex. Now, I'd like to create a new .shp file given by the intersection of the three shp. files previously obtained. How ...
Salvo's user avatar
  • 31
2 votes
0 answers
50 views

Is any GIS processing in Python bound to be single threaded due to the GIL?

I'm processing a really complex geometry using Python and ogr, which is taking forever to compute. Looking at the CPU usage, I've noticed that it never exceeds 100% (more than 100% signals that the ...
Francesco Ghizzo's user avatar
0 votes
1 answer
117 views

Install and run GDBee file geodatabase SQL tool

GDBee is a Python tool for querying file geodatabases using SQL (outside of ArcGIS): https://github.com/AlexArcPy/GDBee I want to install and run GDBee in Windows 10 (64-bit). As a novice, here's what ...
User1974's user avatar
  • 1,132
2 votes
1 answer
120 views

Working with CIRCULARSTRING in OGR's sqlite dialect

ogrinfo ":memory:" -dialect sqlite -sql "SELECT ST_GeomFromText('Point(1 2)')" gives me a dataset with a geometry column: INFO: Open of `:memory:' using driver `SQLite' ...
bugmenot123's user avatar
  • 10.9k
0 votes
1 answer
187 views

Export shapefile to MapInfo file using Python OGR

I'm trying to save/copy a shapefile to a .tab format with Python OGR. Every attempts give me the following error: RuntimeError: CreateFeature() failed: cannot re-write already existing feature 1 ...
Yann 's user avatar
  • 11
1 vote
0 answers
31 views

Converting OGR layer into GeoPandas [duplicate]

I have a huge Geopackage (20 GB), and I want to read in a small subset without overloading my memory. I've figured out how to do this using the Geopackage's Rtree: # Point to huge Geopackage gpkg = ...
Andrew Plowright's user avatar
0 votes
1 answer
137 views

Convert a layer from WGS 84 to WGS 84 / Pseudo-Mercator during GRASS import

I have a bash script that does the following: export PATH=$PATH:/usr/local/grass/bin GRASSDATA=/output/grassdata && \ MAPSET=PERMANENT && \ MAP=outputAmtrakMap && \ rm -rf $...
Mayor of the Plattenbaus's user avatar
1 vote
1 answer
114 views

v.in.ogr does not provide any error information

I am using the mundialis/grass-py3-pdal:8.2.0-alpine docker image to run GRASS. I run the following from the bash command line (inside the container): /usr/local/grass/bin/v.in.ogr input=/path/to/...
Mayor of the Plattenbaus's user avatar
1 vote
0 answers
263 views

QGIS 3.22.11: Cannot save vector layer after modifications (OGR error, non-finite values)

I have a (self-created) shapefile and add e.g. another polygon to the file (or delete a vertex or any other modification) then try to save the file and finish editing, and this message comes: Could ...
AlexaPl's user avatar
  • 11
2 votes
1 answer
70 views

Looking for proper GIS terminology - polygon with a cut in it

(QGIS,GDAL/OGR) I have a polygon produced by contouring that has a small short overlapping line segment. I am wondering if there is a proper GIS term for this and whether there is an automated method ...
Brendan's user avatar
  • 93

1
2 3 4 5
23