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
33 views

Can vector layers using memory data provider render QgsPalLayerSettings label?

I have a memory vector layer created from a GeoJSON feature: feature = { "type": "Feature", "properties": data, "geometry&...
L3w1s's user avatar
  • 101
3 votes
1 answer
476 views

A faster method for converting meters to degrees

I have this algorithm, written in C++, that converts meters to degrees using OGR and GDAL. OGRSpatialReference source, target; OGRCoordinateTransformation* transform; const char* projection = geotiff-&...
magus_e's user avatar
  • 47
0 votes
0 answers
44 views

Delete duplicate vectors from command line

I have one vector layer called "trails" and another called "roads." There are vectors with identical geometry, and I want to delete any vectors in the trails layer with identical ...
Jeshua Lacock's user avatar
1 vote
1 answer
14 views

"RuntimeError: XS: No such file or directory" error while specifying the table when using the GeoPackage source dataset in ogrmerge

I am trying to merge specific tables of multiple GPKGs using ogrmerge. How to specify the table to use when in the source dataset name. When using ogrinfo we can do the following to work with XS table ...
ar-siddiqui's user avatar
  • 1,820
1 vote
0 answers
53 views

Issues with GDAL installation - ogr not available?

I am attempting to install GDAL on my Windows 10 machine. I have previously done this successfully using the wheels from Gohlke's now deprecated site so I am learning a new way to do an old thing. ...
Graham Oxman's user avatar
0 votes
0 answers
19 views

OGR_STYLE Label 'anchor position' not applying in MapInfo Tab file

I've tried creating a label feature in MapInfo using an OGR_STYLE column, but the anchor position (p:12) doesnt seem to be being applied to the label. e.g. LABEL(f:"Arial, Helvetica", c:#...
Prosper's user avatar
  • 115
1 vote
1 answer
38 views

How to create one buffer around all the points using ogr2ogr?

I know how to make a buffer around each point, $ ogr2ogr oom.csv a1.houses.csv -lco GEOMETRY=AS_WKT -dialect SQLITE -sql \ "SELECT ST_Buffer(GEOMETRY,.01,1) AS WKT FROM 'a1.houses'" $ cat ...
Dan Jacobson'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
51 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
73 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
62 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
  • 305
2 votes
1 answer
96 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
48 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.7k
0 votes
0 answers
72 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
195 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,719
2 votes
2 answers
100 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
75 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,534
1 vote
0 answers
85 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
70 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
44 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
93 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.7k
0 votes
0 answers
24 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
127 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
55 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
73 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
208 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
43 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
65 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
150 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
281 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
454 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
475 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
144 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
275 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
  • 11.2k
0 votes
0 answers
104 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
526 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,719
3 votes
0 answers
353 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
  • 31
0 votes
1 answer
101 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
57 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
70 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
67 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
1 vote
0 answers
191 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
225 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
236 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
766 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,662
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
55 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
129 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,222
2 votes
1 answer
131 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
  • 11.2k
0 votes
1 answer
202 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
2 3 4 5
23