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
2answers
85 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:...
0
votes
0answers
358 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?
1
vote
1answer
246 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
84 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 ...
15
votes
2answers
7k views

API documentation for Gdal/Ogr with C#

I want to assign projection to shapefile in my web C# application, for this i am using Gdal/OGR/OSR C# bindings and add osr_csharp.dll and ogr_csharp.dll references. But i am facing some difficulty ...
1
vote
1answer
90 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 ...
6
votes
1answer
7k views

Converting Shapefile to MySQL?

I have used Grass GIS imported a .shp file; I now want to export this file to MySQL. I understood that MySQL will contain the function of all three the files necessary in a Shape file system (.shp - ...
11
votes
4answers
5k views

Get all vertices of a polygon using OGR and Python

I'm having a little trouble with the Python OGR API. What I am trying to do is get all the coordinates of each vertex of the outer ring of a polygon. This is what I have so far: import osgeo.ogr ...
4
votes
0answers
67 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
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 ...
8
votes
3answers
2k views

Mapping between OGR and Python data types?

I'm writing a shapefile using OGR in python, creating fields on-the-fly from a python data source. Creation of a new field requires an OGR data type, is there a mapping between OGR and python data ...
0
votes
0answers
89 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
1answer
90 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
125 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 ...
1
vote
1answer
120 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 ...
2
votes
2answers
44 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 ...
0
votes
0answers
30 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
94 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 ...
4
votes
3answers
1k views

Convert KML to shapefile without losing attribute data

So I want to convert KML files to SHP shapefiles to load it onto PostGIS. Currently I'm using ogr2ogr to do the conversion for me, but it wipes out all the attribute data. How do i preserve this ...
2
votes
2answers
101 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 ...
5
votes
2answers
2k views

Union multiple shapefiles with overlapping shapes

I have several shapefiles that overlap and I would like to union their geometries to get rid of those overlaps. I know how to do this with OGR and Python for single geometries. from osgeo import ogr ...
0
votes
2answers
59 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
1answer
108 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 ...
0
votes
0answers
41 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
2answers
98 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
28 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 ...
9
votes
3answers
2k views

How to stop writeOGR from abbreviating Field Names when using “ESRI Shapefile” driver

I'm currently using the following script to add some attribute data from a table to lots of individual shapefiles: library(rgdal) specieslist <- read.csv("SpeciesList1.txt", header=F) attdata <-...
2
votes
1answer
93 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
0answers
79 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" -...
1
vote
1answer
67 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
79 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
1answer
96 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 ...
0
votes
0answers
23 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 ...
1
vote
0answers
144 views

Python GDAL/OGR: check lines geometries connectivity

I'm working with shapefiles representing roads, so basically it's stored as (poly)lines. I need to perform a road connectivity checking. In other words, I want to ensure that roads meant to ...
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 ...
1
vote
1answer
213 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 ...
2
votes
1answer
595 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
3answers
101 views

ogr: what is the advantage of using `geom.Clone()` over `geom`?

What is the advantage of using geom.Clone() over geom? Simple example: geom = link_feat.GetGeometryRef() newfeature.SetGeometry(geom.Clone()) # or newfeature.SetGeometry(geom) layer.CreateFeature(...
1
vote
0answers
42 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 error:...
-3
votes
3answers
124 views

How can I use ogrinfo to reach information about a .shp?

How can I use ogrinfo? where should I write it? In the visual studio's command prompt or somewhere else? Can you make some examples? when I use ogrinfo in the windows or visual studio's command ...
2
votes
1answer
63 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 ...
4
votes
1answer
652 views

Opening file geodatabases created with ogr2ogr in ArcGIS Desktop?

I've been using the new FileGDB support in gdal-1.9.0 to create file geodatabases that can be opened in ArcGIS. For example (I'm doing this all on one line, so I'm not certain this will run as ...
1
vote
1answer
81 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 ...
3
votes
1answer
164 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
0answers
90 views

How to reach the geometry (polygon, polyline) of a dxf in python-ogr module

this might be a basic question, but I am rather new in ogr. I wish to collect all lines from the dxf file and create their boundary. I loaded the layers (ExecuteSQL( "SELECT DISTINCT Layer FROM ...
5
votes
1answer
1k views

How do you format an OGR VRT file to best convert a CSV to KML?

I am attempting to get a nice KML for simple review of POI/geocoding from a CSV. I a using ogr2ogr and a vrt. You can see the vet file below, with two attempts to get this right. Basically, the issue ...
2
votes
2answers
87 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: ...
3
votes
1answer
57 views

OGR update using case statement

I am looking at updating a number of large shapefiles using ogrinfo and UPDATE. I would like to perform a CASE function to update specific fields with specific values. Is it possible to perform CASE ...