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

learn more… | top users | synonyms

1
vote
1answer
50 views

Intersection with 2 KML files - newbie

I'm new to all this gis thing and I have this project for university where I'm trying to find the countries within a bounding box. So what I'm doing is, I have a set of coordinates that define a ...
1
vote
1answer
35 views

Add attribute of type Date to shapefile using OGR

can anyone tell me how to add an attribute of type Date during a shapefile creation? For Integer works fine using the following code: Layer1.CreateField(ogr.FieldDefn('NumberIndv', ogr.OFTInteger)) ...
0
votes
1answer
40 views

How to extract a shapefile with a SQL expression from a database of shapefiles using PyQGIS or OGR [duplicate]

I have a shapefile Water_Districts.shp that consists of several water district polygons. I am trying to use the script below to 'extract' a specific polygon with the name Cache La Poudre River listed ...
0
votes
0answers
43 views

ogr2ogr - PostGIS to GML with nested attributes

I am attempting to create GML from PostGIS tables and having issues with nested tags. Before I waste too much time on this, I would like to know if what I am trying to do is possible with "ogr2ogr". I ...
0
votes
1answer
50 views

Converting files with ogr2ogr and dropping ALL attribute fields

I want to add a gpx file to a PostgreSQL/PostGIS table using ogr2ogr, but my table does not have any of the fields that are attributes of the GPX file. There are previous questions here dealing with ...
-1
votes
1answer
69 views

The reason why dataset does not create layer

I have a plugin written in Python, and two versions of the QGIS, assembly there are differences, but the main suspect, that the version of GDAL==2.0.0dev (1) another 1.11.3 (2) for first >>>...
1
vote
0answers
58 views

ogr2ogr (or other) simplification of polygons with shared boundaries

I am trying to simplify a collection of 100,000 or so polygons containing nearly 4 million vertices. The data is stored in a 2GB shapefile so there is no explicit representation of the topology ...
2
votes
1answer
68 views

Why is the first element of my WFS layer None instead of a feature?

I have made a WFS connection and got a layer from it. I want to use the first feature from that layer. driver = ogr.GetDriverByName("WFS") wfs_url = "WFS:http://example.com/wfs" wfs = driver.Open(...
3
votes
1answer
79 views

Understanding intersection of GDAL and QGIS?

Background I'm starting a project that will be done entirely through Python, except perhaps at the end for visualisation. So far I've been doing it with ArcGIS and arcpy, but we'd like to move it to ...
4
votes
2answers
87 views

ogr2ogr sql query from text file

In ogr2ogr or ogrinfo, I can successfully query an Oracle database using this command as a test: ogrinfo -al -so "OCI:USER/PASSWORD@SERVER/DATABASE" -sql "SELECT * FROM SCHEMA.TABLE" However, ...
2
votes
1answer
45 views

How to save points without losing z dimension

I try to save Points with OGR. It works well but I lose the z dimension while saving/loading. from osgeo import ogr from osgeo import osr shapePath="...xxx.shp" X='1.0' Y='2.0' Z='3.0' driver = ogr....
2
votes
1answer
53 views

Available Python client libraries for WFS transactions?

I am looking for a Python module to allow me to use WFS-T. Everything I found so far only supports getting data out via WFS, I need to INSERT and UPDATE. owslib does not support WFS transactions (yet?...
1
vote
0answers
31 views

Command line join attributes by location using OGR

I have two overlapping vector files (polygons and sample) and want to do a spatial join from the command line to extract all features in polygons that intersect with sample. Essentially I want to have ...
2
votes
3answers
115 views

I have an existing attribute table that I'd like to add values to the fields within it while preserving the geometry, how can I do this?

I've tried to use fiona and shapely and ogr, but the tutorials seem to be insufficient to describe how to do such a seemingly simple task. In arcpy this could be done simply with an update cursor. I'...
2
votes
1answer
66 views

How to set CRS for a DXF file and prevent any warning on QGIS using pyQGIS?

I am trying to import dxf file with no warnings or popup from Spatial Reference Selector. However, even after modifying QGIS Spatial Reference Selector setting, I still get a qgisMessagebar warning. ...
7
votes
2answers
143 views

Polygons across international dateline [-180..+180 longitude]

I'm trying to generate polygons for satellite orbital swaths. So far I have a method to generate two lines which represent the edge of each swath in [lat,long]. Some of the swath's cross the ...
3
votes
0answers
47 views

Geokettle Data Input from Oracle Database

i just installed GeoKettle and am trying to do some first steps in this. Can anyone help me with the data input step to an Oracle DB? I tried the OGR Input: But i seem to be unable to find the ...
0
votes
1answer
55 views

Failed to export vector file from OGR?

I use to transform data points from UTM (WGS84) to WGS84 EPSG:4326. Basically from UTM to Geographic coordinate system both in (WGS84). I tried to do it again but an error message appears. ...
2
votes
1answer
58 views

Change shapefile field names using ogr AlterFieldDefn

I need to change field names of a shapefile to upper case using ogr. I want to do this automatically, versus calling out each field and replacing the name with upper case. When I try to implement ...
4
votes
0answers
98 views

QGIS/OGR shp to tab export - crashing Mapinfo due to number format issues

I created a vector grid in QGIS and it exports as SHP -no issues. When I save as tab and try to open the file in MapInfo it crashes. According to https://groups.google.com/forum/#!topic/mapinfo-l/sO-...
0
votes
1answer
165 views

Problem with read_shp() in NetworkX

I'm trying to convert a shapefile of only line geometry (a street network) to a NetworkX graph to run some connectivity algorithms on it. I'm running into this issue: File "/Library/Frameworks/...
2
votes
1answer
93 views

How to tile GeoJSON data?

I have a GeoJSON dataset of the following format (LineString features): { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "...
1
vote
1answer
109 views

Can't write decimal data into shape (shp) attribute table with Python

I am trying to create a shapefile with Python GDAL/OGR library. I add to it a real number field, but when I write into it doesn't appear as it should but rounded. I will explain better with the code: ...
0
votes
0answers
60 views

Copy specfic layer to new datasource using OGR Swig Java bindings

Is it possible to efficiently copy a specific layer from one datasource to a different datasource using GDAL/OGR Java bindings? I know it is possible to create a new layer in the target data source ...
3
votes
1answer
161 views

Rasterize vector file using gdal.RasterizeLayer() without losing attribute information in python

Is it possible to rasterize a vector file with gdal.RasterizeLayer(), saving attribute as Raster value ? Like gdal_rasterize can do with : gdal_rasterize -a attribute -ts rasterXsize rasterYsize -l ...
2
votes
0answers
28 views

No Exception Handling in GDAL/OGR java bindings: ogr.UseExceptions() has no effect

When a GDAL/OGR 2.0.1 swig/java operation encounters an error, the message is written to stderr but no exception is thrown within the application -allowing it to continue, which is highly undesirable....
4
votes
0answers
61 views

How to unproject a UTM ESRI Shapefile over WGS84 extent boundaries

Background: I am working on a collaborative project in Python that uses GDAL/OGR to work with rasters and vectors. There is one function that attempts to project one ESRI Shapefile's coordinate ...
3
votes
1answer
161 views

Convert KML to GeoJSON with ogr2ogr and remove KML special attributes

I'm trying to convert KML to GeoJSON (or some other formats) using ogr2ogr (look at this question). It's all working fine, except of one problem: I'm always receiving these metadata attributes with ...
1
vote
1answer
66 views

gdalwarp resampling problems

I'm trying to clip and resample a raster to match the dimensions and resolution of another raster. Here's my gdalwarp command: gdalwarp -t_srs EPSG:4326 -te 102.3375307079206 14.6874037407838 ...
1
vote
2answers
65 views

Calculate Z Median from 3d line?

How does one calculate the median value of Z from a 3D line? The Add Surface Information tool in 3D Analyst only does Min,Max and Mean (average), and requires a surface model. (In this case I have ...
0
votes
0answers
72 views

Rasterize layer with GDAL after attribute filtering

I am working with GDAL/OGR and I need to do the following task : I have a shapefile with many attributes. I performed a query over one of them, "type_of_building='Church'". I have done this with the ...
1
vote
0answers
55 views

How to access a feature by specific field value using python ogr in an efficient way?

I have one point layer and one polygon layer with a common identifier attribute field called "N", same objects amounts but Feature IDs (FID) are different. I have to iterate on the first one and what ...
0
votes
1answer
82 views

Can updates be made to “ogr_fdw” foreign tables in PostgreSQL?

I am accessing a Microsoft SQL Server table (w/ SQL Server a geometry column) via an ogr_fdw foreign table. SELECT statements work great, including the PostGIS functions that I've tried. Are UPDATES (...
1
vote
1answer
274 views

Problem intersecting shapefiles with OGR in Python

I'm trying to move from ArcPy for geoprocessing. After searching some posts, I found this solution using the GDAL/OGR Python bindings: Intersect Shapefiles using Shapely My code is the following: ...
2
votes
1answer
90 views

Visualize PostGIS 3D line geometry [closed]

I have PostGIS table with 2 geometries ( "GEOMETRY(MULTILINESTRINGZ)" and "GEOMETRY(LINESTRINGZ)" ). There are lines made just from 2 points - XY are WGS and both of them have random elevation Z (I ...
0
votes
1answer
39 views

Determining of vector dataset single files to specify its size on a disk

I wonder how to get size of disk space that a specific vector dataset occupies on a disk. I didn't find any ogr2ogr util or OGR Python method that can return a list of files that belongs to given ...
4
votes
0answers
72 views

SQL SERVER 2012, Python subprocess, OGR

Need help with uploading shapefile with srid 102008 to SQL server 2012. I ran the ogr2ogr script in the ogr shell and it uploaded the shapefile within seconds but when I try using python subprocess to ...
0
votes
0answers
96 views

How to access ArcSDE metadata using OGR?

I'm trying to get a list of all layers in an ArcSDE database hosted in oracle here is the command I'm using: ogrinfo -al SDE:localhost,5151,sde,sde,sde Note: I've replace the database, username ...
1
vote
2answers
90 views

How to access Shapefile metadata and metatypes information using OGR?

I'm trying to use ogrinfo to get some details on a shapefile. Now, the only way that I know is using orginfo: ogrinfo -ro -so -al BRA_001.shp But its display all information about the shape: INFO:...
1
vote
1answer
96 views

Gdal ogrinfo CSV unable to open datasource

When I try to import a csv file into a PostgreSQL table with the Gdal ogr2ogr tool I get the "Unable to open datasource" Failure. So I tried to open it with the tool ogrinfo and I get the same Failure....
2
votes
2answers
138 views

How to add attribute table to new shapefile using OGR?

i have made a new shapefile from the original shapefile , and now i want to copy the attribute table from the original shapefile to the new select shapefile , but i don't know how to do that? import ...
2
votes
2answers
45 views

How to select form the attribute table in with ogr

i want to select the (Sumava) from the attribute table and then make a shape file, my problem is i don't know which function should i use to select this area.if any one can help me? import ogr import ...
1
vote
1answer
132 views

Batch convert dgn files to shp files using ogr2ogr

We have hundreds of dgn files which have to be converted to shapefiles. I am trying to use these commands to batch convert all the dgn files in a folder. for %%f in (*.dgn) do ogr2ogr -f "ESRI ...
0
votes
0answers
32 views

GDAL/OGR in C++: Opening a vector file

So I'm making a vector file this way: OGRSFDriverH hDriver=OGRGetDriverByName("KML"); OGRDataSourceH hDS=NULL; hDS = OGR_Dr_CreateDataSource (hDriver, fname_dst, NULL); //I add layers OGR_DS_Destroy(...
1
vote
1answer
99 views

GDAL/OGR in C++: Merge multiple vector datasets to single [closed]

I need to merge multiple kml files into a single one. I found that I could use "ogr2ogr -append" but I have to do it through c++ and my Google-fu hasn't been successful so far. So, any ideas? Also, ...
1
vote
1answer
19 views

Is it possible to append shapefiles based on field values using ogr2ogr?

We have 5 "Master" shapefiles(A, B, C, D & E). Each will have different table structure. We have 100's of shapefiles which has features which has to go to A,B, C, D & E. We have a column in ...
0
votes
2answers
62 views

Skip a specified input layer in ogr2ogr

I am using ogr2ogr to load data from multiple GML files into PostGIS. As shown in the ogrinfo output below, each GML file has multiple layers. Had to open data source read-only. INFO: Open of `D:\...
0
votes
2answers
112 views

Will .sbn and .sbx files (spatial index) speed up operations in GDAL/OGR?

I'm trying to intersect large datasets in OGR and python using SQL queries like ST_Intersects and ST_Contains. These operations run very fast in ArcMap but I'm designing a system to automate them, ...
0
votes
0answers
43 views

Strange behaviour / weird results using ogrinfo + WFS + spat

I want to use ogrinfo to get features from a WFS within a bounding box. I know I can use the "-spat minx miny maxx maxy" parameter for this, but it does not work. Here's what works, what not, and what ...
0
votes
0answers
32 views

OGRGeometry::exportToWkb return buffer empty

I would like to export OGR Geometry in WKB format. I used the function OGRGeometry::exportToWkb from OGR. The problem is that the buffer returned by the function is empty and OGRERR_NONE is always ...