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

0
votes
1answer
23 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 ...
1
vote
0answers
27 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
57 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
16 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
29 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
17 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 ...
4
votes
0answers
34 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
85 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
38 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
53 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
36 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
24 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
0answers
21 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
71 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
43 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
35 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 ...
3
votes
0answers
41 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
24 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
53 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: ...
1
vote
1answer
54 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 ...
2
votes
2answers
81 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
37 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
52 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
24 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 ...
1
vote
1answer
52 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
17 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
32 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 ...
0
votes
2answers
49 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
35 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
17 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 ...
0
votes
0answers
29 views

Converting DXF to GeoJSON with ogr2ogr

I'm trying to convert my DXF to GeoJSON with ogr2ogr, but I can't get it to include blocks. ogr2ogr -f "GeoJSON" "/Desktop/test2.geojson" "/Desktop\drawing.dxf" -sql "SELECT * FROM entities" ...
2
votes
1answer
54 views

How to Automate Symmetric Difference using OGR in Python

I need to try and automate the process of creating mask layers by using the symmetric difference of two different polygon layer files (they are currently in .TAB format, however these can be converted ...
0
votes
1answer
50 views

Creating point shapefile from GeoTIFF using GDAL/OGR?

I have a 0.05 deg global maps (~8000 files) in GeoTiff format. It's a kind of a mask containig "1" and "0". I need to create a point shapefile for each raster with points located over "1" values of ...
1
vote
1answer
50 views

Dissolve in ogr / python

I have a set of ~100,000 polygons (.shp format). Using python and ogr I would like to dissolve them to one feature class to speed up other downstream operations. The command I am using is: ogr2ogr -f ...
2
votes
1answer
61 views

Create new shapefile based on values ranges in existing shapefile using gdal/ogr/python

I have a shapefile containing many thousands of polygons with values stored in an attribute field and ranging 0-105. I would like to create a much simplified file that contains classes for value ...
0
votes
0answers
19 views

OGR_LINK_FIELD to filename in a Geospatial PDF

Im using gdal_translate to create a Geospatial PDF. im trying to add file path to my feature when clicking on them by using: -co OGR_LINK_FIELD=<column whit path> i creating my pdf in the ...
0
votes
0answers
17 views

using import ogr in Arcgis python [duplicate]

I need to use import ogr in my python window provided by ArcGIS 10.2, but i can't configure ogr and gdal on my system. Please tell me how i can fix this issue and import ogr in my python window ...
0
votes
0answers
12 views

Scripting procedure to clip vector lat-long file to those that fall within a raster? [duplicate]

I am looking for something similar to this thread, but in a scripting procedure which can be run through a Bash shell. In essence, I have a vector of latitudes and longitudes that span most of ...
0
votes
1answer
51 views

Improving performance of Clip using OGR?

I have a set of points which I am trying to clip to a set of polygons. The files have many features (150,000 polys, 8,000 points). I'd like to automate this process carry it out once a day, hence I am ...
1
vote
0answers
34 views

Extract raster values to multipoint shapefile and write to new field using gdal/python [duplicate]

I have a raster with one band and I would like to query a set of overlying points (.shp) to determine how many points as well as which points points fall under a range of certain pixel values ...
2
votes
1answer
203 views

Calculate area of polygons using OGR in python script

I have a shapefile of many thousands of polygons. I'm trying to append an area field to the attribute table and calculate the area of each polygon (in sq. meters) driver = ogr.GetDriverByName("ESRI ...
2
votes
2answers
60 views

Count Distinct with Where clause in OGR

I am looking to run a query in OGR to write back all instances where there is only one record of an attribute. I was thinking that I would use the following: ogrinfo -dialect sqlite -sql "SELECT ...
1
vote
0answers
39 views

problem with saving/processing layers in QGIS

I recently encountered the following problems with a shapefile in QGIS 2.10.1: when I simply tried to save the layer as a new layer, there is error message: "Feature geometry not imported (OGR ...
1
vote
1answer
59 views

No GDAL/OGR package for Ubuntu 15.04?

Using Ubuntu 15.04, I'm trying to install GDAL/OGR. I did: [] sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable [] sudo apt-get update However, I found this error message W: Failed to ...
1
vote
1answer
113 views

Count number of points within multipolygon shapefile using OGR

I have two shapefiles: 1) consists of points (hundreds of entries) and 2) multi polygons (tens of thousands of entries). I simply need to count the total number of points contained within the ...
0
votes
0answers
103 views

Dissolve using GDAL/OGR?

I'm trying to dissolve a shapefile according to a field using Python 2.7.10 and I don't want to use ArcPy. Is there any way to do this using GDAL/OGR?
2
votes
1answer
51 views

Write ogrinfo result to text file

I have obtained a desired value from a dataset using: ogrinfo input.shp -dialect SQLite -sql "SELECT SUM(field) from input The ogrinfo command prints the desired value via the command line when I ...
3
votes
1answer
63 views

Calculate new field from existing fields using expression in gdal/ogr and append to shapefile

I'm trying to calculate a new field from existing fields based on a simple expression for a set of polygons in GDAL/OGR. The expression is basically: new field = (field 1 / field 2) * field 3 ...
1
vote
1answer
56 views

How to rasterize a point layer with multiple features falling inside a raster cell?

How to make a raster with values that are the sum of all points inside each raster cell? The burn value is a specific attribute. Using gdal_rasterize or gdal.RasterizeLayer(), the resulting raster ...
2
votes
2answers
54 views

Using .DXF Arc or Circle accurately in ArcGIS for Desktop?

I need to use a .DXF in either QGIS or ArcGIS. However, if an Arc occurs in a .DXF drawing and if this file is opened in QGIS, I noticed that the geometry of the Arc is simplified. I did a test: ...