Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ogr]

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

0
votes
0answers
22 views

Connect points with lines (preferably using gdal)

I have point geometries of a Germany highway network like this: The data that I have also contains the road number, specific road ID, latitude, and longitude of each point. I'd like to connect those ...
0
votes
1answer
21 views

GDAL/BUILD can't get result files Geojson to mbtiles

i try to 2.55gb of GeoJson (maybe 200 over layers in one file) to vector Mbtiles, but fail to create .mbtiles. so i try convert each layers(.shp) to geojson(over 200 files), then create each ....
0
votes
0answers
17 views

Can any suggest an open source workflow to convert an Esri LiDAR terrain dataset to a LAS file

I’ve got a very large file geodatabase (1TB) that contains LiDAR data stored as a multiple terrain datasets. I’d like to spatially filter the data and export the result as a LAS file without using ...
1
vote
0answers
19 views

Can't set OGR layer geometry type in Python

I'm trying to create a layer of geometry type polygon, with a feature of geometry type polygon, and a geometry of type polygon. However, no matter how I attempt to set the geom type of the feature, ...
0
votes
1answer
39 views

gdal/geopandas data object compatibility in python

Is it possible to convert an ogr datasource into a geopandas GeoDataFrame without writing the datasource first as a physical file and reading it back? I am referring to something like import ogr, ...
1
vote
1answer
140 views

Where is official documentation of gdal/ogr?

Where can I find the official docs for gdal/ogr python API? I am looking for something comprehensive which shows all the classes with descriptions of their attributes, methods and input/output types....
0
votes
1answer
39 views

OGR multipolygon with holes model

I'm trying to unpack shapefiles in C# using GDAL-OGR library, but I'm confused about the structure of multipolygon with holes in OGR. As far as I know, the models of shapefiles and OGR geometry (the ...
0
votes
0answers
8 views

Why ogr UnionCascade() fails when Union() not?

I have 2 multipoligons to merge: g1 and g2. I've noticed that: g1.AddGeometry(g2) reult = g1.UnionCascaded() gives result = None. When: result = g1.Union(g2) gives me proper result. What is the ...
1
vote
1answer
24 views

Python OGR: Filter Shapefiles by Lat Long and Export To CSV

Using osgeo's Python API for OGR, I'd like to implement the following process: Import ESRI Shapefiles from a given directory (call it input_dir) Import a CSV file that contains lat-longs of interest (...
0
votes
0answers
11 views

OGR SQL Intersect layer slow to iterate

I am having an issue with OGR's ExecuteSQL, but not with the actual SQL query. What I am intending to do is to take a large number of polygons ~500k and find out if they intersect with a ...
0
votes
0answers
37 views

Converting a geopandas/shapely object geometry to ogr geometry

I use a python package which has many vector operations in-built (https://github.com/dshean/pygeotools/blob/master/pygeotools/lib/geolib.py), but this accepts as input an ogr type geometry object. ...
0
votes
0answers
15 views

Intersecting files with different projections

I am attempting to calculate the intersection of two files(vectors/shapefiles) that have different projections but would in real life have actual overlap. I am attempting to do this using the ogr ...
1
vote
2answers
34 views

.Length() method from ogr is crashing python

I created a simple 1-feature polyline shapefile in QGIS 2.18. I would like to now read this shapefile in gdal using python and extract its length. I have done the following import ogr driver = ogr....
0
votes
0answers
25 views

How get attributes from GeoJSON

How can i get only attributes names from GeoJSON? ogrinfo gets attributes with others info: ogrinfo -al -so rw.geojson Output is: ERROR 4: GeoJSON Driver doesn't support update. Had to open ...
0
votes
0answers
70 views

GDAL/ogr2ogr ( to convert osm to shapefile)

I use GDAL / ogr2ogr to convert osm to shapefile but I get an error. C:\Users\alo>ogr2ogr -f "ESRI Shapefile" outputdir "C:\Users\alo\Desktop\London.osm" Warning 1: Cannot find osmconf.ini ...
1
vote
0answers
39 views

ogr2ogr: filter on date-field

ogr2ogr -spat_srs EPSG:31370 -spat 179600 167350 179800 167500 -f "ESRI Shapefile" test.shp "WFS:http://ccff02.minfin.fgov.be/geoservices/arcgis/services/WMS/Cadastral_Layers/MapServer/WFSServer?" ...
3
votes
1answer
83 views

Create Hexbin (honeycomb) grid using command line or Python

Qgis has this amazing Create Grid function. Is there an alternative for python / unix command line? I've found Gdal_grid but it is not the same. The goal is to eventually create a hexbin heatmap.
0
votes
0answers
9 views

geodjango ogrinspect on geojson layer returns all field lengths to zero

I have a geojson layer which I am running python3 manage.py ogrinspect reporter/data/parcels.geojson parcels --srid=4326 --mapping --multi which returns from django.contrib.gis.db import models ...
0
votes
0answers
23 views

Convert total area calculation from ogrinfo (cli) to python ogr

How can I do this command (source): ogrinfo -q -sql "SELECT SUM(OGR_GEOM_AREA) AS TOTAL_AREA FROM way" way.geojson with Python ogr? from osgeo import ogr
0
votes
0answers
11 views

How to use our polygon intersect on all rows on 2 dataframes

If I have to intersect all rows of one dataframe geom column with another dataframe geom column without using for loop, how can I do that? geom1 = ogr.CreateGeometryFromWkt(df['geom_value'][0]) ...
0
votes
2answers
65 views

OGR says that my data source is invalid when I use the method QgsVectorLayer in PyQGIS

I am begining with PyQGIS and QGIS in general. I wanted a way to create a layer via python, so i downloaded "Plugin Builder" and starded coding. Here's the code : def activatePlugin (self): ...
0
votes
0answers
30 views

gdal: apply orthorectification to ogr dataset

I'm trying to process Digital Globe L2A image with gdal utilities (e. g. this one: https://www.digitalglobe.com/resources/product-samples/washington-dc-usa) I am using SRTM digital elevation model to ...
1
vote
0answers
22 views

ogr SetPrecision doesn't work

I'm creating a shapefile with a field type of real, but I want to lower the standard precision from 15 decimal places to 10, here is my code: dst_filename = "Polygonized.shp" drv = ogr....
0
votes
0answers
32 views

ogr2ogr: Transformation from NAD27 to WGS84 not working

I'm trying to use ogr2ogr to transform from NAD27 to WGS84 and check the precision afterwards. For that, I used a GML file with coordinates -124.0, 48.0 It looks like this: { "type": "...
1
vote
0answers
27 views

Avoiding grids when transforming between SRS using ogr2ogr?

I'm trying to use ogr2ogr to transform from NAD27 (EPSG:4267) to WGS84 with my custom "towgs84" Bursa-Wolf parameters. However, I think the ogr2ogr uses grids which are part of the GDAL installation ...
5
votes
2answers
232 views

Uploading Geopackage contents to PostgreSQL

As a bit of background, we are looking to transition away from the use of shapefiles. We've already started using Geopackages for desktop work (QGIS / ArcGIS) but often have a requirement to upload ...
2
votes
1answer
35 views

How to call geom.Polygonize() with OGR?

The Python documentation for OGR lists a Polygonize() method belonging to the Geometry class, as does the C documentation. The docstring suggests it can be called on a geometry object of type "...
0
votes
1answer
34 views

Problem reading shapefile with Python ogr-module

Trying to read naturalearthdatas shapefile vers. 4 "ne_110m_admin_0_countries.shp" with the python-ogr.modul I encounter a problem. inspecting the file with the following code-snippet: counter = 0 ...
1
vote
1answer
47 views

How to specify transformation method when using ogr2ogr to reproject geometry?

I have a question regarding geometry transformation using OGR/GDAL (or perhaps another open-source solution). Let's say I need to transform geometry from one coordinate system to another using ...
1
vote
1answer
21 views

Reading attributes only using ogr2ogr

I'm trying to use ogr2ogr to extract some attributes from a Shapefile to a netCDF. I can limit which attributes are read using the -select argument, but it seems that the geometry is written to the ...
1
vote
0answers
19 views

Copying a WFS layer to the disk, using GDAL's Python bindings? (it creates empty files)

I'm quite new to ogr/gdal (both in osgeo4w shell and python) and I have tried to set up a script that should connect to a WFS and download a specific file. The best match to my problem was this ...
0
votes
1answer
33 views

Using ogr for osm file to be used in pgrouting?

i was following this http://workshops.boundlessgeo.com/tutorial-routing/#preparing-data tutorial about building a routing application and thus im stuck in the step of preparing the data as to i dont ...
1
vote
1answer
24 views

OGR writing MapInfo Tabfiles with column Indexes

I'm using ogr2ogr to convert MSSQL to MapInfo File and would like to add indexes to some of my MapInfo columns, is this possible? This is what I have so far set ogr2ogr="C:\Program Files\GDAL\...
0
votes
0answers
107 views

Creating new attribute in polygons from raster values with GDAL?

I have shp files with polygons and I want to set a new attribute for each polygon and retrieve the value from a global raster map,using gdal. I found code to achieve this with points ( create a new ...
0
votes
1answer
36 views

Can I change the level of detail of shapefile with OGR?

I`m working in a project where I must display shapefiles. I'm using OGR to read the shapefile data and use QT to display it. At this moment, I can display correctly shapefiles with around 2000 ...
0
votes
1answer
18 views

GDALOpenEx define papszOpenOptions

I'm using GDAL/OGR to open shapefiles. Now i'm calling this method to open a dataset: dataset = (GDALDataset *)GDALOpenEx(path.toStdString().c_str(), GDAL_OF_VECTOR, NULL,NULL, NULL); I read in http:...
0
votes
1answer
52 views

Copying raster to SQLite using GDAL?

I want to copy a raster file into SQLite database. Previously, I did the same with vector data like this: def store_vector_output(self, file_name, identifier): from osgeo import ogr drv = ogr....
0
votes
0answers
46 views

Importing Shapefile into PostGIS and EPSG of created table is different from Shapefile?

I'm trying to import a Shapefile into PostGIS using the ogr2ogr, but it seems that the OGR is not automatically getting the EPSG from Shapefile. My Shapefile has EPSG 4618, but the table created by ...
1
vote
0answers
33 views

GDAL/OGR Error: Cyclic VRT opening detected

GDAL 2.2.4 (64bit Windows) throws an error during opening of a cyclic OGRVRT file. There was no problem with cyclic VRTs in GDAL 1.10.1 (32bit Windows). Here is a sample VRT file, which I used to ...
0
votes
1answer
57 views

ogr2ogr -sql command when appending to PostgreSQL database: what functions are available?

I am trying to append a set of polygons from a shapefile to an existing table in a PostgreSQL/PostGIS database. The destination table only has a geography column and an 'attributes' column with jsonb ...
1
vote
1answer
149 views

Gdal RasterizeLayer Python

I'm attempting to rasterize a layer of a raster by using the different features inside a shapefile(In this case the different features are lines). The problem I am running into is that ...
0
votes
1answer
100 views

Densify Shapely polygon using OGR Segmentize

I am trying to densify geometry of polygons loaded by GeoPandas using ogr.Geometry Segmentize. When I print new geometry, it is densified as intended, but it will never save into the shapefile. It ...
1
vote
0answers
107 views

GDAL/OGR Returning wrong reprojected shapefile

I use the script in this link to reproject a shapefile and save it. The target projection is derived from a georeferenced raster. The problem is while the target coordinate system is UTM 33N (epsg: ...
0
votes
0answers
43 views

Intersection between point and world land shapefile with python

I use python and OGR to check if a point is located inside a polygon and then find its distance from the nearest edge. I know that the code I use works, but because the polygon is actually the whole ...
0
votes
0answers
37 views

Cannot open a SpatiaLite connection using ogr in Python

I need to open SpatiaLite connection to copy data to the database. This is my code: from osgeo import ogr dsc_in = ogr.Open(file_name) if dsc_in is None: raise Exception("Reading data failed.") ...
0
votes
2answers
58 views

Extracting coordinates from multipoint geometries?

I found this guide to get pixel value of raster under point: Getting pixel value of GDAL raster under OGR point without NumPy? I've a problem here: for feat in lyr: geom = feat.GetGeometryRef() ...
1
vote
2answers
173 views

How to connect to a SpatiaLite database using ogr in Python?

I need to connect to a SQLite/SpatiaLite database to copy data there. I have done the same with PostgreSQL/PostGIS like this: connection_string = "dbname={} user={} password={} host={} port={}"....
1
vote
1answer
46 views

Is there a vector format for depicting continuous 2D polygons with attributes?

I'm working within the QGIS environment and looking for a 2D continuous vector attributed editable file format to work with. My goal is to find a vector layer that has different features with no ...
2
votes
1answer
38 views

ogr2ogr issues in clipping tab to shp where tab has points and lines together

I am running a simple script to clip and convert all tab files in a directory via osgeo shell for %f in (*.TAB) do ogr2ogr "%~dpnf_Clip.shp" -clipsrc "clipped\AOI.TAB" "%f" -f "ESRI Shapefile" It ...
0
votes
0answers
37 views

VRT file in S3 including shapefiles

I have a bunch of shapefiles zipped and stored in S3 bucket. I would like to create virtual format file from those, and also stored in S3. For now I am able to read zipped file from s3 using ogr ...