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
0answers
12 views

FileGDB In GDAL Docker container with dot net core

Currently, I am using this docker image pepperlk/gdal that has FileGDB built in and working via command line. Details here: gdalinfo --version GDAL 3.3.0beta1-b75f14ab12155c6b6f4544a9894c41f2f9a7d241, ...
1
vote
0answers
36 views

Loading a GML file to PostGIS using Python and GDAL vectortranslate: encoding problems

I have some GML files I want to load into my PostGIS database using the GMLAS reader in GDAL in a Python script. The script is run from a batch file. For example this dataset from Geonorge - https://...
0
votes
1answer
31 views

ogr2ogr cannot import data

I can successfully get a connection to my remote sql server database using: ogrinfo "MSSQL:server=my_server_name;database=my_database;Trusted_Connection=True;" But when I try to import an ...
2
votes
1answer
44 views

Getting intersecting polygons of points using OGR and Python

I have multiple files that essentially have anywhere from 2000-5000 points each. I have a polygon file that has about 10000 polygon shapes. For each file containing the points, I want to get all the ...
0
votes
0answers
42 views

Reduced/Increased size polygons with Buffering GDAL/OGR

In case somebody needs to do the buffering of geometries (using pure OGR). I am trying to create reduced/extended polygons from an existing polygon using OGR in Python. The abstract idea that I have ...
0
votes
0answers
22 views

Python OGR: Features of layer inside another layer

I'm trying to find features from a layer that are within another layer. To do so, I first created a geometry with the geometries from the filtering layer (created by adding geometry or union), and ...
2
votes
1answer
46 views

GDAL Virtual File Systems Python Opening files in Network Drive Issue

I'm trying to open a .tar file using /vsitar/ The file to be opened is located at: //my_network_drive/scratch/my_file.tar In Python I have the following snippet: driver = ogr.GetDriverByName('ESRI ...
0
votes
0answers
17 views

Implementation for Boolean operations on polygons like union, intersections, contains?

https://en.wikipedia.org/wiki/Boolean_operations_on_polygons#Algorithms I wish to understand how are Boolean operations on polygons implemented in GIS related geometry libraries. I've tried to go ...
1
vote
1answer
33 views

Choosing efficient output format for spatial data in R

I'm assembling a moderately large spatial dataset as simple features in R (4.0.5). Is there a good way to select the most performance-efficient output format/OGR driver to save my assembled data? I'm ...
1
vote
1answer
35 views

Get OSM building heights using height or building:levels tags

I want to parse OSM data and to get all buildings with height or building:levels data. I changed osmconf.ini file to read height and building:levels tags as separate columns for multipolygon layer but ...
2
votes
0answers
24 views

Connection pooling in OGR PostgreSQL driver

OGR (GDAL) provides a vector driver for "PostgreSQL" and data in the DB can be accessed with something like the following: driver = ogr.GetDriverByName("PostgreSQL") datasource = ...
2
votes
2answers
205 views

Create a shapefile from geometry with OGR

As I see from the GDAL/OGR available solutions, most of the new OGR data sources (shapefile etc.) are being created from an already existing similar file. This way many steps of directly creating ...
1
vote
1answer
44 views

How to batch rename tables in GeoPackage with OGR

I would like to rename all tables in a GeoPackage file. The "translations" are stored in a .csv file. I would like to do this on the command line and found the below thread that uses the ...
3
votes
1answer
57 views

GDAL Rasterize with “where” option in Python

I've got a shapefile with set of points with a column "test_class" of String type in the attribute table. I need to rasterize these points with setting pixel's value for each class and ...
0
votes
1answer
38 views

OGR reports incorrect SRS for GeoJSON

OGR (GDAL 3.2.2) appears to incorrectly read the SRS of GeoJSON features and I would like to know if there is anything I can do to prevent this. I have two GeoJSON files and both represent the same ...
0
votes
1answer
24 views

st_combine and st_union produce empty attribute table for shapefile (how to edit before st_write?)

I am starting with R programming and I am having a hard time figuring out how to edit the attribute table of a shapefile after using st_combine and st_union. My shapefile has multiple polygons and I ...
1
vote
1answer
24 views

How to find WFS layer geometry type, when the layer is empty (0 features)?

Is it possible to find the geometry type of a layer in a WFS, using OGR, when the layer is empty (0 features)?
2
votes
1answer
55 views

How can I use GDAL installed with QGIS from command line?

I have QGIS 3.10 and I can run GDAL using OSGeo Shell. I want to be able to use GDAL commands from command line. For now, when I run gdalinfo --version I get message 'gdalinfo' is not recognized as an ...
1
vote
1answer
41 views

Is it possible to create a VRT file with ogr2ogr?

I want to create VRT files from ungridded .asc files (example file). The VRT files should look like this: <OGRVRTDataSource> <OGRVRTLayer name="worms"> <...
0
votes
1answer
25 views

How to use gdal_grid with ungridded .asc DTM files

There was a question about processing ungridded .asc DTM files: Problem processing Slovenian LiDAR DTM with GDAL (and QGIS): "too many stepY values" error The answer helped a lot already, ...
0
votes
0answers
14 views

Difference between overlapping polygons using OGR

I’m trying to do a simple difference between two polygons using ogr, but I can’t make it work. The input layers have the same CRS. The input polygon is a multipolygon, and the overlay polygon is the ...
4
votes
1answer
45 views

Is there a reason I should use gdal's Python library instead of just using os.system(gdal command)?

From my understanding, there is gdal installation that you can just access through the shell then there is the Python library version for it with 'Python bindings' that map to the original. My current ...
1
vote
2answers
55 views

Detecting if a point is inside a polygon with Python 3 and OGR

I am working in Python 3.7 using ogr to check if a point is inside a polygon. Here I put the code. The result in geom is not compatible with the tuple list data type used by the point_inside function. ...
0
votes
2answers
28 views

Compare multiple projection strings to shortlist unique projections

I have a list containing multiple projection strings. Each string is unique but there are some string which are same projections despite being different. [ "PROJCS[\"...
0
votes
1answer
40 views

Get input layer extent as new GeoJSON polygon on the command line

Starting from a GeoJSON file containing a country boundary polygon, I would like to obtain a rectangular approximation: another GeoJSON consisting of the bounding box/envelope of the original polygon. ...
0
votes
1answer
74 views

ogr2ogr SHP to MSSQL import leaves geometry column empty

I am trying to import a Shapefile with polygon features into MSSQL database with this command: ogr2ogr -f "MSSQLSpatial" "MSSQL:server=***;uid=***;pwd=***;database=***" "D:\...
2
votes
0answers
19 views

How to use WHERE IN clause with ogr2ogr [duplicate]

I am exporting some tables from PostGIS to a geopackage. My command to do is task is as follows ogr2ogr -append -f GPKG E:\workspace\test.gpkg PG:service=XXXX -where app_einzugsgebiet.hauptgemeinde=...
0
votes
1answer
78 views

ogr.BuildPolygonFromEdges fails on my multiline

Using python ogr, polygon = ogr.BuildPolygonFromEdges(multiline) fails for the following multilinestring: Does anyone know why? It throws the error: RuntimeError: OGR Error: General Error with ...
2
votes
1answer
114 views

OGR2OGR import to SQL from geometry to geography

I'm trying to import a shapefile to SQL Server 2019. This command works: ogr2ogr -f "MSSQLSpatial" "MSSQL:server=[myserver];database=test;tables=CAPZONE;UID=[myuser];PWD=[mypassword];...
1
vote
0answers
41 views

Deleting GDAL created raster

I am simply trying to delete a TIF that I created with GDAL. I have tried, simply, to use shutil which errors with: NotADirectoryError: [WinError 267] The directory name is invalid: 'T:/p003M01p0001/...
0
votes
0answers
13 views

How to create a PGDUMP from LVBAG format using ogr2ogr?

I am trying to figure out how to use this GDAL driver to create a SQL dump, using the ogr2ogr commandline. I have tried the following: ogr2ogr -oo AUTOCORRECT_INVALID_DATA=YES --config PG_USE_COPY=YES ...
2
votes
1answer
42 views

How can a spatial reference system be corrupt per OSR while valid per QGIS?

I have this coordinate reference system defenition: GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM[&...
1
vote
1answer
38 views

Python GDAL/Ogr Weird 3 Axis Output [duplicate]

I have this code: driver = ogr.GetDriverByName('KML') data = driver.Open(kmlFile) layer = data.GetLayer() geom = nextFeature.GetGeometryRef() print(geom.ExportToJson()) I am trying to export any ...
2
votes
0answers
22 views

SIGSEGV when loading vector file with QgsVectorLayer class, yet ogrinfo looks valid?

I have a program set up as part of a QT application written in C++ to overlay data on a KDE Marble map, and am using the C++ API from QGIS to achieve this. I create the vector file as a GeoJSON by ...
0
votes
0answers
41 views

How to interpret what each return means from an OSR function?

I have searched internet for the documentation on what different returns from OSR functions like osr.SpatialReference().IsProjected(), osr.SpatialReference().Validate() means but I couldn't find ...
1
vote
0answers
153 views

OGR error: file location not a directory [closed]

I have an Excel file that I converted to CSV. Then I used MMQGIS to geocode CSV with web service. Then I use the OpenStreetMap as the type of web service. I make sure the to be converted file is going ...
2
votes
1answer
77 views

Merging CSV layers (XYZ files with point coordinates)

I have list of many XYZ files with points without header an space delimited. Example: -877500 -1014000 471.95 -877500 -1013995 472.28 -877500 -1013990 472.61 -877500 -1013985 473.04 -877500 -1013980 ...
0
votes
1answer
26 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
votes
1answer
22 views

Should a GDAL vector dataset have a geotransform?

For example: Does a shapefile have a geotransform? The answer is probably: No, a vector dataset does not have a geotransform, because the purpose of a geotransform is to transform between projection ...
0
votes
0answers
32 views

QGIS does not recognize projection of ESRI geodatabase file (.gdb): How to set the projection so that QGIS does regonize it?

I want to load an ESRI geodatabase file into a project in QGIS and I am new to working with databases in QGIS. When I try to do this the layers from the database are loaded without any CRS or it seems ...
4
votes
1answer
111 views

Python - Correct way of closing ogr.DataSource() objects

I learned that I need to close objects that I open, usually using a with open(): statement that does the closing for you after leaving it. With GDAL/OGR, this does not work and objects must be closed ...
4
votes
1answer
125 views

Changing field values on a attribute table using GDAL/OGR (ESRI Shapefile)?

I am trying to create a new column on attribute table of my shapefile. This table must be the FID formatted with 4 (or any number) digits (for instance: 0 = 0000, 1 = 0001, 2 = 0002...) but I just can'...
0
votes
1answer
69 views

OGR Resetting SetAttributeFilter and SetSpatialFilter

This is more of a behavior question about OGR. When I set the spatial and attribute filters like so: self.ogr_layer.SetSpatialFilter(clip_geom) self.ogr_layer.SetAttributeFilter("MyField =...
1
vote
1answer
78 views

How to override shapefile geometry type in OGR

I'm new to ogr. I tried to copy a WFS layer to shapefile using CopyLayer but I get this error. ERROR 6: Geometry type of `Multi Curve' not supported in shapefiles. Type can be overridden with a layer ...
1
vote
1answer
21 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 ...
0
votes
1answer
66 views

OGR - 'NoneType' object has no attribute 'CreateLayer'

I have an error when i wan't to create a Shapefile layer with OGR. When I run my script for the first time, everything all right, layer is well created. But when i run it for the second time ...
1
vote
1answer
72 views

Removing and overwriting layer from interface within Plugin

I want to create a shapefile with a QGIS Python plugin. If the same shapefile is already in QGIS Interface, I need to remove it, delete it from the computer, create the new layer and load it. When I'm ...
0
votes
0answers
22 views

Creating shapefile using GDAL OGR? Script runs but does not create the files

This script runs but does not create the shapefile files. It works, however, if I were to replace the driver for GeoJSON and create a GeoJSON file. Context: I'm working through Chris Garrard's "...
1
vote
0answers
53 views

Creating and writing GeoPackage Lookup Tables

I am writing Python using OGR to create and write a single vector layer in a GeoPackage. Some of the feature attributes need to be foreign keys to several lookup tables. My needs are completely ...
2
votes
1answer
180 views

Geometry buffer updating with ogr2ogr

I am trying to modify a dataset by replacing the geometry of each feature by its buffer. I try to do it directly, in update mode (not very secure I know). Here is what I tried: ogr2ogr -update test....

1
2 3 4 5
20