Tagged Questions

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
0answers
8 views

What is the input format to the M-GEMMA map matching tool?

I am researching different map matching algorithms. Based on the Map Matching StackExchange discussion I came across the M-GEMMA tool written in C++, which can be downloaded here. A literature discuss ...
1
vote
1answer
22 views

What is a OGRGeometryShadow and why can't I use it in Intersects()-method?

I'm trying to script something with Python and GDAL/OGR and Shapely. What I have: two LineString geometries: "geom1" and "geom2" I made an Intersection: "intersection = geom1.Intersection(geom2)" ...
0
votes
1answer
16 views

Python OGR Geometry changes Floating Points

I'm creating a Polygon in OGR and adding coordinates to it in Python. It is a must that my coordinates aren't allowed to change when adding, however they do and I don't understand why. Here is my ...
0
votes
1answer
26 views

ogr2ogr convert DXF to GeoJSON with defined geometry

I trie to convert a DXF file into a GeoJSON file with: ogr2ogr -f 'GeoJSON' -sql "SELECT * FROM entities WHERE layer = 'geom_test'" test.json dfxtest.dxf Is it possible to convert only geometries ...
2
votes
1answer
26 views

Partial loss of projection data converting to MapInfo File with OGR

I'm trying to convert some data from ESRI Shapefile to MapInfo TAB format using ogr2ogr. The data is projected using the British National Grid (EPSG:27700). The output file is valid, and the geometry ...
3
votes
0answers
22 views

What is the area that OGR extracts from the (geometry) shp files for polygons?

The ESRI July 1998 technical documentation for polygon shapefiles at page 10 makes no mention of either area measures or length measures (apart from byte/record-layout matters). Yet OGR enables me to ...
1
vote
0answers
37 views

Loading virtual vector layer in QGIS

Can QGIS read layers in OGR's virtual vector format? It seems to work with VRT raster files, but it reports my layer is an invalid data source for vectors. http://www.gdal.org/drv_vrt.html I'm ...
2
votes
0answers
39 views

QGIS : cannot change the z-coordinate of a point shapefile using the wkb geometry format

I am using QGIS Desktop 2.5.0-Master with GDAL/OGR 1.11.0 on a windows 7. I am working on a little pyQGis script that should modify the z-coordinate of points in a vector shapefile based on a value ...
0
votes
2answers
52 views

building GDAL with libKML support

I'm attempting to import a kml/kmz file generated using Google Tracks into my QGIS 2.4 system (built with GDAL 1.10). KML files currently lose all attributes, and as such I'm attempting to build GDAL ...
0
votes
1answer
32 views

Geoprocessing tool Difference from the Terminal?

I have used QGIS Geoprocessing tool Difference to cut polylines (SHP) into to smaller pieces using a polygon (SHP). This works very good in QGIS. Now, to speed up the process, I'd like to be able to ...
0
votes
0answers
18 views

OGR Virtual Format - How To Do Join

I have to kluge together a bunch of disparate data sources, and think the OGR Virtual Format may be an elegant solution. In looking at the documentation, I can't seem to find a way to join 2 layers ...
2
votes
1answer
65 views

problem transforming CRS coordinates EPSG:4269 to EPSG:3857 in python

source_srs = get_srs(shp_abs_path) source_epsg = source_srs.GetAttrValue("PROJCS|GEOGCS|AUTHORITY", 1) print source_epsg #prints 4269 target_epsg = 3857 # because these are headed to leafletjs ...
0
votes
0answers
17 views

DeleteFeature work very slowly with a MemoLayer

I have a python custom geoproccess wich use osgeo.ogr with a 'Memory' datasource. It work pretty fast except in one point where I need to delete feature known by id in a list. duplicated.sort() #list ...
1
vote
1answer
47 views

how to open shp file which created by using python-ogr in qgis?

I have done following steps, so how I open that created shp file in Qgis driver=ogr.GetDriverByName('ESRI Shapefile') out=driver.CreateDataSource('pts.shp') ...
0
votes
2answers
78 views

Improving this script - GPX reading and processing with Python OGR

I am trying to plot every GPX trace I have in a folder, by reading it with Python-OGR, clipping it by a bounding box, and plotting Curently I have a working script, but it seems very uggly, and I ...
1
vote
1answer
85 views

How to get the mapserver WFS OGR driver to encode unicode in geojson

Running mapserver 6.4.1, gdal 1.14.3 I try to output some WFS features using outputformat=geojson. The relevant bits of the mapfile are appended below. Everything works fine, but unicode characters ...
3
votes
2answers
59 views

Python, OGR and Mapnik: Possibility of passing existing ogr.Open() datasource into Mapnik without using mapnik.Ogr()?

Okay, I'm trying to modify create_utfgrids.py to use an OGR VRT file, rather than shapefiles, and while the OGR stuff in this code responds to the VRT, the Mapnik stuff is not. It's failing with.. ...
1
vote
2answers
43 views

Ogr2ogr not executing

I am trying to run this Ogr2Ogr command but it doesn't execute when entered. What is wrong? ogr2ogr -f GeoJson -where "neighborhood IN ('Lower East Side', 'Greenwich Village', 'Columbia St', ...
0
votes
1answer
43 views

Explicitly close a OGR result object from a call to ExecuteSQL

How can I explicitly close/release the result of an ExecuteSQL statement when querying a Spatialite database with OGR via Python? I have a simple query to return the SRID of a dataset. This works as ...
2
votes
1answer
63 views

How do I link OGR with spatialite?

Problem & Evidence: I'm trying to create a spatialite file with the code snippet below. However the outDataSource object gets assigned NoneType and all subsequent (unshown) code fails. I'm ...
1
vote
1answer
80 views

ogr2ogr reprojection works on command line but shifts output when same command run from inside python?

Reprojection with ogr2ogr works fine on command line, but shifts the polygon to northeast when same command is run from inside python using os.system(...) Any ideas why this could be? I hard-coded ...
1
vote
2answers
74 views

Error getting ESRI Shapefile driver OGR in C++

I am unable to create an OGR Layer using the C++ API. I have followed the documentation at this link exactly http://www.gdal.org/ogr_apitut.html I get an error trying to get the shapefile driver. Any ...
0
votes
0answers
32 views

Importing OGR from OSGEO Issues

I am trying to run: from osgeo import ogr and I get: Traceback (most recent call last): File "", line 1, in from osgeo import ogr File ...
1
vote
0answers
43 views

Converting MDB File With Unicode Characters

I'm using C# wrapper of GDAL and I'm having a problem converting MDB file that contains unicode characters. Lets take for example conversion to KML file, non-English characters are replaced by '?' ...
0
votes
0answers
36 views

ogr / osr for node.js / javascript

I use a python module I created that does tests for point in polygon. It uses the python osgei/ogr and osr modules. Specifically, I use the following elements of these modules: ...
1
vote
0answers
40 views

QGIS crashes when trying to display features form MySQL

I import shapefiles into MySQL using the following command: ogr2ogr -f MySQL MySQL:GIS,host=localhost,user=root,password=root /home/user/Public/myshape.shp -nln Shape_table -update -overwrite -lco ...
1
vote
1answer
51 views

Convert list of coordinates to OGRGeometry or WKT

I am using a Visvalingam-Whyatt simplification script and the output is a list of coordinates such: [[[[-10885205.10690245 3525662.26531131] [-10885369.01690829 3525374.0741439 ] ...
2
votes
1answer
75 views

SetFeature creates infinite loop when updating sqlite feature using OGR

when using the SQLite driver in python - setting a feature after changing an attribute field value creates an infinite loop on the first record. the same code works fine if i substitute the sqlite ...
2
votes
1answer
105 views

How to get the two nearest points between two polygons

I'm trying to draw the nearest line between the nearest polygons in a Polygon dataset (ESRI Shapefile). I know that for this purpose there is the Near Tool (ArcGIS), but it just return the point TO ...
2
votes
0answers
59 views

How to export postgis points as blocks in dxf with ogr2ogr

I'm trying to export postgis points as blocks to DXF format. I have a simple table in postgis with columns: CREATE TABLE pod_com_azimuth ( ogc_fid integer, rotation double precision, pointtype ...
0
votes
1answer
37 views

Adding a Vertex To Exisiting Feature(linear) Using OGR Python

I am working on a project that involves finding the intersection of linears in a shapefile, if that vertex(the found intersection) doesn't already exist for each(or one) of the features, then that ...
2
votes
0answers
97 views

Can OGR handle Esri's Geodatabase extensible markup language (XML) files?

The USDA Forest Service distributes GIS data as Esri Geodatabase extensible markup language (XML) files. I downloaded one in the hopes that I would be able to convert it to something less esoteric ...
1
vote
1answer
99 views

Using OGR Intersection Method Python

I'm currently working to find the intersections between linears in a shapefile. I'm a newbie to the GDAL/OGR library. I've done some googling and came up with what seems to be a useful example(see ...
7
votes
2answers
329 views

Conflict between ArcPy and GDAL/OGR?

TL;DR I can't get an installation free version of GDAL/OGR to work from within ArcMap 10.0. I get an ImportError: DLL load failed on _mod = imp.load_module('_gdal', fp, pathname, description). ...
0
votes
0answers
42 views

Exporting ArcSDE feature class to shapefile using OGR?

I'd like to export data from ArcSDE for SQL Server to SHP. I've tried first to run this python script in QGIS: http://trac.osgeo.org/gdal/browser/trunk/autotest/ogr/ogr_sde.py But finally I've got ...
1
vote
1answer
58 views

Why does this python OGR code for creating a layer and then adding a field not work?

Spot the difference! So this works... fp = "C:\\LiDAR\\MyLayer.shp" layer = "MyLayer" driver = ogr.GetDriverByName("ESRI Shapefile") data_source = driver.CreateDataSource(fp) srs = ...
2
votes
1answer
29 views

OGR DeleteDataSource not working properly in Python

I have a small Python script which is supposed to delete a shapefile in case the file is empty. import sys from osgeo import ogr drv = ogr.GetDriverByName("ESRI Shapefile") ds = drv.Open(inData) if ...
0
votes
2answers
281 views

MultiLineString to separate individual lines using Python with GDAL/OGR, Fiona, Shapely

There are lots of MultiLineString features in a polyline shapefile. The problem is to split these lines into separate individual lines. There is a similar question with PostGIS, but I need to code in ...
1
vote
0answers
42 views

QGIS view bounding box on Add vector layer GeoGSON protocol?

Our server can serve GeoJSON with an optional bounding box HTTP parameter. e.g. http://our_gis_server.org.au/layername?bbox=xmin,ymin,xmax,ymax In QGIS I can add this vector layer as a Protocol and ...
1
vote
1answer
36 views

Extracting z values from shapefile using OGR Api

Is there an example of how we can extract the z value from a shp file given the x,y coordinate value (namely utm) using gdal/ogr c++ lib? alternatively, would it be easier if we convert the shp file ...
0
votes
1answer
135 views

Creating records in output shapefile using Python

I have a list (output from a previous loop) containing attributes from an input shapefile. What I am stuck with is inputting those attributes to a new shapefile. I have plotted the point data using ...
1
vote
1answer
77 views

ogr SimplifyPreserveTopology does not keep the Topology

I use ogr2ogr to simplify a layer of polyline, from the document: -simplify tolerance: (starting with GDAL 1.9.0) distance tolerance for simplification. This method will preserve topology, in ...
0
votes
0answers
58 views

SetSpatialFilter worked unexpected when using ogr by python

I am using ogr python binding to read the shapfile, this is the code: ..... bbox="POLYGON ((20.18164062 30.63867188,20.63867188 30.63867188,20.63867188 30.18164062,20.18164062 30.18164062,20.18164062 ...
1
vote
0answers
14 views

Asking about OFTInteger data type in OGR/GDAL?

I created the shape file by using the feature field type: OFTInteger. But when I open the file in Arcgis (ArcCatalog) the data type is: Double (not integer). Do you know how to fix this (I want it ...
1
vote
1answer
183 views

Writing shapefile with projection defined crashes fiona

I've just started trying to use Fiona to write out shapefiles. I found the example code below, which seems to work fine from shapely.geometry import mapping, Polygon import fiona # Here's an example ...
1
vote
1answer
75 views

How to filter date values using OGR 1.11.0?

With OGR 1.10.1 this works: ogrinfo test2.shp -sql 'SELECT COUNT(*) FROM test2 WHERE DATE < "1970-01-01"' Note that DATE is a column of type date (not string). (Here's test data if you want to ...
0
votes
0answers
40 views

Comparing datums with GDAL/OGR

I have a bit of code in Java that takes in a SpatialReference object and checks that it is one of the acceptable datums (WGS84, NAD83, NAD83 HARN, NAD27), but because of the lack of standardization in ...
0
votes
1answer
49 views

TileStache can't find spatial ref for vector layer

I have a query based vector layer in my TileStache configuration, and it's hitting this block of code if layer.GetSpatialRef() is None and driver_name != 'SQLite': raise KnownUnknown('Couldn\'t ...
2
votes
2answers
56 views

How to replicate ArcGIS coordinate transformation with ogr2ogr?

I need to be able to replicate with ogr2ogr a coordinate transformation that was executed in ArcGIS for Desktop. Both ArcGIS and ogr2ogr are based on EPSG standard definition. There's not only one ...
0
votes
1answer
80 views

no viewable feature when creating line with ogr in python

the python code below produces the expected line shapefile viewable in QGIS import os from osgeo import ogr drv=ogr.GetDriverByName('ESRI Shapefile') if os.path.exists('test.shp'): ...