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.

2
votes
1answer
43 views

Can't open specific layers with Qgis nor OGR

I'm working with mutliple sets of layers in order to create a new one. As I need to load them directly from the internet, I use both /vsizip/ and /vsicurl/ But I'm stuck at loading one of them. Here ...
0
votes
0answers
20 views

GeoRefrencing in Gdal using x,y of four Corners

I have co-ordinates of all four corners of a raster and i want to Georefrence the raster using those co-ordinates, I can specify the following in SetGeoTransform # (uperleftx, scalex, skewx, ...
0
votes
1answer
12 views

ogr2ogr polygon to point with point inside the polygon

Can ogr2ogr be used to convert a polygon to a point but the point must remain inside the polygon? It does not matter where the point is as long as it is inside the object polygon.
0
votes
0answers
19 views

Combine GeoJSON files into bigger shapes with external JSON to merge on

I have a shapefile of New York ZCTAs here I also have these neighborhood definitions that map zip codes to New York City Boroughs. I'd like to take my "all of New York zip code" data and: Clump up ...
0
votes
0answers
21 views

OGR SetAttributeFilter does not let datasource to update

I am trying to update an attribute value for a certain feature in a shapefile. To filter out that feature, I use SetAttributeFilter. This returns the feature I want, and SetFeature also works as ...
1
vote
0answers
8 views

Which polygons intersect rectangle in PHP/Linux GDAL?

I'm developing a website where I want to test which polygons from a shapefile intersect a given rectangle. Using PHP, I thought about using exec() function, calling a GDAL program, like ogrinfo. ...
1
vote
1answer
49 views

QGIS cannot save to SpatiaLite after vector difference?

In QGIS I have a spatialite DB full of roads. I'd like to do a Difference operation (Vector > Geometry Tools > Difference) with another layer in order to keep roads only available in a given ...
0
votes
0answers
32 views

OGR: Read Shapefile text field raw bytes

I am trying to read a shapefile using OGR with C#. (GDAL.NET). The text fields (and some field names) were encoded in windows-1256 encoding. I used : Gdal.SetConfigOption("SHAPE_ENCODING", "windows-...
0
votes
1answer
32 views

Get a bounding box of a geometry that crosses the antimeridian using OGR

I'm trying to get a bounding box of the geometry that crosses the antimeridian using OGR: from osgeo import ogr geom = ogr.CreateGeometryFromJson('{"type":"MultiPolygon","coordinates":[[[[-180.0,-40....
1
vote
1answer
28 views

C++ OGR GDAL Set spatial reference of new layer

When creating a new layer using OGR / GDAL in C++, how do i set the spatial reference? OGRLayer *poLayer2; poLayer2 = poDS2->CreateLayer( "layerName", NULL, wkbPoint, NULL ); if( poLayer2 == NULL ...
0
votes
0answers
31 views

OGR - List of polygons contained in a polygon

I have two groups of polygons A and B. I wish from the group polygon B to single out all the polygons that are contained in the polygon A. For example: Based on the example I want to isolate all ...
4
votes
1answer
28 views

Get a list of all supported EPSG code from OGR

I need get a a list of all supported EPSG code from OGR/GDAL. I need this becaouse i'm developing a C++ application map, and I need this information to put it in a user form. I read the OGR ...
0
votes
1answer
30 views

Get path of feature classes in feature datasets without arcpy

I'm looking for a way to get the full path of a feature class within feature datasets (either in personal or file geodatabases) without using arcpy. My first attempt was to use ogr which works fine ...
0
votes
1answer
34 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
26 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
48 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
61 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
271 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
52 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
11 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
33 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
21 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
67 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
17 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
39 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
30 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
124 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
54 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
111 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
14 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
27 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
16 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
83 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
56 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
26 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
57 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
28 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 ...
6
votes
2answers
483 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
39 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
36 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
50 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
23 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
36 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
38 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
30 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
145 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
37 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 ...
1
vote
1answer
26 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
57 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 ...