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

2
votes
1answer
844 views

QGIS 2.0 without MySQL connector

On a mac (Mountain Lion), after a major upgrade to GDAL (1.10) and related frameworks from KyngChaos page, QGIS 2.0 doesn't show any MySQL connector: Add Vector > Database > ... The driver ...
1
vote
0answers
49 views

Why is the performance of ogr methods different on different OS?

This question actually comes forth from an earlier question of mine . A short introduction. I was writing a program that performs near analysis and creates buffers for a set of points. On my Linux ...
5
votes
2answers
585 views

Python: how to speed up spatial search (nearest point)?

I'm working on a program that determines the closest location from a given point. The point cloud I'm testing against is very big (~800.000). However, this doesn't really explain why my implementation ...
2
votes
1answer
501 views

ogr2ogr specify lat/long order on conversion to GeoJSON

When using ogr2ogr to convert a polyon from a .shp file to GeoJSON, I noticed that it writes the coordinates in order lat, long. I noticed this because whenever I tried to view the GeoJSON on a map, ...
1
vote
0answers
84 views

How to join attributes by location with command line

I would like to joint the attributes of 2 shapefiles by location but with a command line (linux). This feature is easy in QGIS but it is VERY slow. Is there a way of doing this with ogr or pyqgis ? ...
2
votes
1answer
353 views

Clip and copy files to same directory structure using OGR/GDAL with Python

We need to clip all our data (many TB) by a new boundary and save it while maintaining the same data structure. I want to use OGR/GDAL as the data is in shp/tab/kml/geoTif/ecw etc. I can find the ...
0
votes
0answers
33 views

How to split a feature using GDAL

I want a feature to be cut into 2 or more based on deviation of a segment i.e., the angle between 2 successive segments. At places, I may also require to merge 2 or more features.
1
vote
2answers
153 views

will ogr get coordinates in geographic coordinate system or projected coordinate system when using getPoint(int,OGRPoint*)

Consider the code that I have written in the stackoverflow question How to extract vertexes of geometries in ESRI shapefiles using ogr library with c++, I have used the code to show shapefiles on an ...
0
votes
0answers
71 views

How to use projection of a shapefile in order to have a better view in OpenGL

As you see here, this is the code that I have used to extract vertices of ESRI shapefiles in order to show them with OpenGL. I have also uploaded my project here, if you want to give it a try and see ...
1
vote
3answers
530 views

Can I have two kinds of point geometry in a shapefile or I should create multipoint shapefiles?

Following my previous question, can I have a mixture of two kinds of geometry in a shapefile of type point. Just like I have about shapefiles of type polygon or I should always create a shapefile of ...
-3
votes
1answer
77 views

How can I use ogrinfo to reach information anout 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 ...
0
votes
0answers
118 views

How to access vertices in a polygon layer using ogr library with c++

up to now I have tried these classes in order to extract the vertices of polygons: OGRPolygon : It doesn't have any method to get number of vertices, start point and end point. OGRLineString : ...
2
votes
2answers
172 views

Change python + ogr2ogr.exe to python + ogr

I have written several complicated python scripts that end up using ogr2ogr to load or translate data. I have been converting these scripts to standalone exe files meaning the team do not require ...
0
votes
2answers
90 views

please Introduce me a free 3rd party library appropriate for showing Geospatial information

Up to know I have used GDAL to extract raster data from geotiffs and then opengl's used to show that raster data. But when it comes to extract vector data with the help of ogr library, what library ...
0
votes
0answers
162 views

How to read vector datasets using GDAL library

Up to now, I have used GDAL in order to read raster information and geotiffs and show them with the help of OpenGL. Now I have a vector dataset, and by that, I mean I have the files with types: DBF ...
0
votes
2answers
105 views

Python ogr: why is GetFeatureCount() so slow?

I did some profiling for a program I wrote and discovered that ogr's layer.GetFeatureCount() is significantly slower than just using python's BIF len(). Here are my test results def test(): ...
1
vote
2answers
1k views

No ogr module despite having gdal installed?

I am trying to use the mapping component of the wonderful PySAL package, but for some reason I do not have the ogr module. I was under the impression that it came packaged with gdal. Am I missing ...
1
vote
1answer
153 views

OGR: How to best use GetFeature on a selection?

I think the following is very confusing sel_str = "ND_14 = '108'" l.SetAttributeFilter(sel_str) l.GetFeatureCount() >>> 1 In a for-loop this gives me for f in l: g = ...
0
votes
0answers
58 views

OGR: How to control the spatial reference of a layer?

I want to use a subset of a shape for a spatial filter. The filter returns 0 features which is unexpected. So I was checking the spatial references of the layers and one of them seems to have none. ...
2
votes
2answers
146 views

OSM linestring shown as point

I have loaded the following file http://openstreetmapdata.com/data/coastlines to postgreSQL. In visual studio with gdal/ogr and geos enabled: SELECT geom FROM waterpoly WHERE geom IS NOT NULL LIMIT ...
3
votes
1answer
107 views

is it possible to project a shapefile to a raster's custom projection with command line gdal/ogr?

I have a raster with a user defined sinusoidal projection and a shapefile in lat/lng coordinates (I believe this is called 'unprojected'?). I'd like to use ogr/gdal's command line utilities to ...
2
votes
1answer
596 views

Polygonize.py outputs into a single file or simple merge?

Given an unique raster topographic file at start, I want to get vector polygons for elevations thresholds 1m, 200m, 500m, 1000m, 2000m into a single shp file. I first slice my raster into 5 (or more) ...
0
votes
1answer
251 views

How to conditionnally assign a new value to pixels of a raster image?

Given a topographic GIS raster of one country crop.tif: Given a know pixel value such as elevation (z) is +73 : $ gdallocationinfo crop.tif 1 1 -valonly > 73 Given an elevation threshold n = 50 ...
0
votes
2answers
239 views

Gdal: How iterate through all pixels of a raster image?

Given a topographic raster image. How to iterate through all pixels of this raster image ? Solution preferably with gdal, in console. Some other libraries/script could be installed. Related: ...
1
vote
1answer
265 views

Error during conversion of shapefile to MySQL using ogr2ogr

I have installed MS4W in Windows 7. I get an error when I try to convert a shapefile to MySQL database using GDAL/OGR ogr2ogr. This is the command I'm trying: C:\ms4w\tools\gdal-ogr>ogr2ogr -f ...
1
vote
1answer
149 views

OGR: How to save layer from AttributeFilter to a shape filter?

I select a subset of features from my shape file like so: node_lyr = nodes.GetLayer() q_str = "%s = %i" % (field, value) node_lyr.SetAttributeFilter(q_str) What is the best way to make a shape file ...
0
votes
0answers
239 views

GDAL/OGR to extract pixel values

I want to use GDAL/OGR to extract pixel values from a raster file. The extraction should be based on polygons, stored in a shapefile. My thought was to iterate over the features in the shapefile, ...
1
vote
1answer
130 views

Importation of .csv on grass gis converts numeric data to string data

When importing a csv file on grass7, the numeric data is converted into a data of type string. My csv looks like this : id_core value 1 F1 83.0611472396 2 F2 98.8584345936 3 F3 ...
0
votes
1answer
151 views

What is required to get OGR to work with SQL Server?

All, I've been having heaps of trouble getting OGR to connect to our SQL Server development environment. (read about it here and here) SQL Versions: 2008, 2012 OS's: Windows 7, Ubuntu 12.04 My ...
0
votes
1answer
184 views

Why won't OGR connect to my PostGIS database, but QGIS will?

Trying to connect to my PostGIS database with some success... One hiccup is that OGR will not connect to my server from a remote machine, though QGIS can connect to it just fine from that same ...
1
vote
0answers
127 views

How to shift vertices of shapes in shapefile using FOSS python library?

I need to shift each vertice of shape in a shapefile (of any type:point, line, polygon, multiline etc.) with Python. I need to loop in all shapes, get the vertices, get it's coordinates and for each ...
2
votes
2answers
682 views

How to read csv with WKT geometry in Arcmap?

I have found several parcels I need on a county map viewer. However, the only option to download any of the data is found on a click context menu to "Copy selection as csv" which gives me this: ...
2
votes
1answer
102 views

Using ogrinfo to list all projection source of a database [closed]

I have to reproject all the layers from a database, but some of them are undefined and some are defined in a wrong projection. I would like to sort all those layers in a text file with their source ...
1
vote
1answer
148 views

How to make a virtual layer from ogr geometry?

I know how to do this: nodes = driver.Open(node_nav,0) node_lyr = nodes.GetLayer() node_lyr.SetSpatialFilter(None) But how do can use the layer methods on a geometry I created from scratch? ...
2
votes
1answer
349 views

How do I get the centroid of line with OGR

Can somebody explain how to get the centroid of a feature with ogr? I have no idea what the centroid() function itself does. >>> linelyr = lineshp.GetLayer() >>> f = ...
0
votes
1answer
92 views

ogr SetAttributeFilter uppercase?

How do I use the ogr SetAttributeFilter with uppercases? Code example: lyr = shp_obj.GetLayer() sel_str = "%s = '%s'" % (field, value) lyr.SetAttributeFilter(sel_str) Can I just do: sel_str = ...
0
votes
1answer
209 views

SetGeometry problems when using python/ogr

So i am trying to use the difference function and i pretty much create the new file i want but the Geometry is empty. No error is produced. any help would great! Thanks. #!/usr/bin/env python import ...
0
votes
1answer
68 views

VSI File API support in ogr2ogr

It seems that support for streaming input is wishy-washy in ogr2ogr. For example, why can I do this: curl "http://data.usgin.org/arizona/wfs?service=WFS&version=1.1.0& ...
1
vote
2answers
138 views

Erase method using ogr

I'm trying to find the erase geoprocessing method as i am familiar with in ARC, but i can't seem to find it in OGR using Python. I have looked through the module ogr documentation but perhaps i missed ...
3
votes
1answer
865 views

ogr2ogr coverting DXF to shapefile, why am I losing part of the feature?

I'm starting to mess around with some of the GDAL toolsets, specifically the ogr2ogr. I'm working with converting a 2000 ACSII DXF file to shapefiles depending on geometry. Everything seems to work ...
2
votes
1answer
96 views

Is there a quicker way of checking if a feature exists with OGR

I'm writing lot's of features to a FileGDB using OGR. The slow point in my script is checking that the feature isn't already in the Feature Class, based on the ID. Currently I'm using a function ...
0
votes
1answer
75 views

Is georeference the same as geotransform?

Does georeference mean the same as geotransform? If not then what is the difference?
6
votes
1answer
240 views

Geometry Projection Speed Test

Lately I've been using the OGR projection classes that come with ogr/gdal, but pyproj was recommended to me, so I thought I'd give it a try. To help me decide if I should make the switch, I did a ...
2
votes
2answers
451 views

Python GDAL/OGR: retrieved feature is NoneType

I'm doing some scripts in Python to deal with shapefiles, and I have an issue I don't understand. I'm looping over a shapefile, and I want to retrieve the geometry of each feature, but very often I ...
0
votes
1answer
166 views

how is the command of ogr2ogr for converting the adf to shp?

What is the correct format of ogr2ogr for converting the ADF grid to SHP file? I tried this, but it fails. $ ogr2ogr -where "OGR_GEOMETRY='Point'" -f "ESRI Shapefile" SHP.shp ADF.adf
1
vote
0answers
89 views

Gdal/Ogr - OGRLayer.Intersection() Question

I was trying to perform intersection on two feature classes (shape file format) using OGRLayer.Intersection(), but have problems making it work with C# bindings. I am not able to figure out on how to ...
1
vote
1answer
80 views

Offset shapefile to start from prime meridian

I have Natural Earth shapefile (for example this file: link) covering whole globe in -180:180 range. I want to offset this file, so that it starts from Greenwich prime meridian instead -180. How can ...
0
votes
0answers
72 views

Confusing offsets in shapefile written by QGIS/OGR

I think I'm stuck here. A shapefile has been updated in QGIS. Records have been deleted and those records have been marked with an asterix in the first byte of the record in the dbf file. I open the ...
2
votes
1answer
170 views

How to sort features in a layer using OGR/Python?

How can I sort the features of an ogr layer by the values of a field? I tried naive variations of def sortlayer(ds, layer, field): lname = layer.GetName() lsort = ds.ExecuteSQL(b'select * ...
0
votes
1answer
212 views

How to create feature LineString in a Polygon shape file layer (OGR/GDAL)?

I used below codes to create ShapeFile layer OGRDataSource *poDS, *poSHPDS; OGRLayer *poSHPLayer; ...... poSHPLayer = poSHPDS->CreateLayer (shpFileName, NULL, wkbPolygon , NULL); And I ...