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
21 views

dissolve polygons of GeoJSON with gdal/ogr

I have a GeoJSON with only polygons in it. I have to dissolve (merge) the polygons with the same "DN"-value. I found out that you can do it with shapefiles like this: ogr2ogr outputfile.shp ...
0
votes
0answers
19 views

Reading/writing utf-8 encoded data using Fiona?

So I have a 'cpg' file with my 'in_file' shapefile data (definitely set to 'utf-8'). I was using 'meta' to create the same schema/crs as 'in_file'...though it runs, my text fields are borked on ...
0
votes
2answers
45 views

How to measure distance using shapely

Reading the documentation...it looks like I should have this right, but I don't. The example is: Point(0,0).distance(Point(1,1)) 1.4142135623730951 Based on this example I wrote this block ...
1
vote
1answer
43 views

How to call 'shapely' .coords on a fiona filtered list?

I have to filter a shapefile by attribute then compare it to another shapefile using .coords...however I am a bit perplexed how to do this as my filter is returning a list type...(and .coords requires ...
0
votes
1answer
26 views

Converting JSON to GeoJSON MultiPoint using `ogr.CreateGeometryFromJSON`

I am trying to convert a JSON array to a geom in Python, by first converting it to a GeoJSON. I have point coordinates in a JSON array, [{'lat':100.0, 'lng':0.0},{'lat':101.0, 'lng':1.0'}] that ...
1
vote
0answers
17 views

create image out of geojson (gdal_rasterize?)

Short version: I need to know how I can convert a .geojson-file to an according .png-file (or any other image format) long version: I have a .geojson which was created by gdal_polygonize from a .png ...
0
votes
0answers
18 views

Using GDAL with a line layer and points layer, find next point along line layer

With the points layer and line layer, I'm trying to create a graph for path finding. I've got a line layer that I've dissolved, thinking that might make this easier. The points in the points layer lie ...
2
votes
1answer
80 views

QGIS 2.8.1 ogr OpenFileGDB zip format

I am experimenting with the OGR OpenFileGDB zip file format in QGIS 2.8.1 on Windows 8.1 x64 and although OGR says it can happily read the format (with a couple of Code Page warnings) I am unable to ...
0
votes
1answer
29 views

Coordinate Transformation in Gdal/Ogr (EPSG:4326 to EPSG:3068)

I think gdal/ogr(/proj4) doesn't recognize epsg:3068 right? Here is what I tried: public static void transformSRS(){ // creating EPSG:4326 SpatialReference sourceSRS = new ...
0
votes
0answers
14 views

Reprojecting: Different results in OGR and PROJ.4 for EPSG24373 (India) [duplicate]

I need to convert EPSG4326 lon/lat tuples to EPSG24373 (Kalianpur 1880 / India zone III). However, when using the Python bindings of OGR and PROJ.4 (pyproj), I get different results. I wrote the ...
2
votes
1answer
63 views

Difference between osgeo gdal/ogr python module and GDAL C++ library

I am developing application in python and I use the osgeo gdal/ogr python bindings for gdal, but its not clear to me what exactly is the difference between the gdal/ogr in python and the gdal library ...
2
votes
2answers
140 views

GDAL in C++: Reading a ShapeFile

I am trying to use the GDAL Lib to read a ShapeFile (.shp). I followed the instructions of http://www.gdal.org/ogr_apitut.html - But it doesn't work! #include <gdal_priv.h> #include ...
1
vote
0answers
48 views

How to set time field when generating a GPX track with Python OGR?

I want to generate a GPX file with Python OGR. In particular I want to generate a tracks (layer of features of OGR type wkbMultiLineString) My script is below. I get the error ERROR 1: No such field: ...
1
vote
2answers
79 views

Find unit of EPSG-Code

I need a way to find out the unit of an EPSG-Code (e.g: meter) from java (ogr, gdal, osgeo?) but any other approach would be fine as well. I want to do something like: if(epsg.unit==meter){ do ...
1
vote
1answer
20 views

Processing feature string fields to raster

I am using the GDAL python bindings. I am trying to rasterize a layer from an arcinfo coverage file, but the values I need to rasterize I have to calculate from string fields. OGR can not write to ...
1
vote
1answer
33 views

How to get GML layer CRS with OGR Python?

I have a GML layer obtained from a WFS that looks like this: <wfs:FeatureCollection xmlns:ms="http://mapserver.gis.umn.edu/mapserver" xmlns:wfs="http://www.opengis.net/wfs" ...
0
votes
0answers
28 views

ogr2ogr in java gdal

I would like to code ogr2ogr -f "GeoJSON" destination.geojson source.geojson -s_srs EPSG:3068 -t_srs EPSG:4326 in java-gdal. I tried to understand how it should work by looking at this example but ...
1
vote
0answers
31 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 ...
2
votes
1answer
25 views

Python-OGR how update the geometry of a point

I need to change the coordinates (geometry) of some points in a shapefile. I can't find the good method. if ( zone[best_y, best_x] >= ( nb_pixel_area - toler) ) and ( zone[best_y, best_x] <= ( ...
1
vote
1answer
38 views

Adding Origin to Geotiff using Python GDAL?

Alright, so I'm getting closer to figuring this out but I'm stuck at one (that I know of) thing... how do I use GDAL to apply a known origin of a GeoTiff to another that has been processed in ...
1
vote
0answers
23 views

Ogr Python API: set null values in feature

Im trying to convert OGR geodata from one driver to another, like the command line tool ogr2ogr do, but using the python API. My problem is, that the NULL values in the input data are converted as ...
1
vote
1answer
87 views

Writing a shapefile using OGR, from Shapely Geometry - No feature added Error

I am trying to write a shapefile from a Shapely geometry using PyQGIS in the QGIS 2.6.0 console. Lines of code before the OGR method to write shapefile: extnt = poly.extent() # gives a QtRectangle ...
2
votes
1answer
57 views

Creating Spatialite DB from Swedish OSM

Good afternoon, I have just started to use GDAL/OGR and I am trying to create a spatialite DB from OSM data. I am using a cut of the Swedish OSM data downloaded from Geofabrik in .osm format. I have ...
0
votes
0answers
31 views

vsicurl on shapefile is requesting data outside file size range

ogrinfo --debug on --config CPL_CURL_VERBOSE YES -ro -al -so "/vsicurl/http://ascendxyzdatastagingweu.blob.core.windows.net/915295c046e0428e8f4fc94ce9188133-upload9/JORDSTYKKE.shp" given the above ...
4
votes
1answer
96 views

Access ESRI .GDB in PyQGIS

I can access ESRI .GDB data using OSGeo's OGR. The following code gives feature class names embedded in .GDB... from osgeo import ogr driver = ogr.GetDriverByName("FileGDB") data = ...
3
votes
3answers
124 views

Plotting Geo Points with “by arc centered at” Instructions

A recent Supreme Court decision redefined the legal boundaries of California along the Pacific Ocean: http://www.theverge.com/tldr/2014/12/15/7397085/supreme-court-california-boundaries-map I am ...
0
votes
1answer
70 views

How to set the spatial reference to a OGR layer using the Python API?

I create new a Ogr Layer with the Datasource.GetLayer() method: driver = ogr.Open(input_file).GetDriver() datasource = driver.Open(input_file, 0) input_layer = datasource.GetLayer() If the input ...
1
vote
1answer
47 views

How to copy a geometry with Python OGR?

I want to copy a geometry with Python OGR within a loop: I tried the following, but I get ERROR 1: Empty geometries cannot be constructed import ogr import copy d = ogr.Open('sampleData.geojson') l ...
3
votes
2answers
310 views

”No module named ogr” when installing QGIS plugins

In QGIS 2.6.1, when I try to install the FlowMapper and QGIS Cloud plugins, I get an error - "The plugin is broken. Python said: no module named ogr" - giving me the only option of removing them. ...
2
votes
1answer
113 views

QGIS crash when I try print geometry

I do (it works): from osgeo import ogr inputds = ogr.Open(r'c:\temp.shp') inputlyr = inputds.GetLayer() for i,feature in enumerate(inputlyr): print i, feature.GetGeometryRef() Output: 0 ...
1
vote
1answer
51 views

Gdal+Geos point in polygon test fails under MinGW64

I have to build a grid of points and remove the points that falls inside a polygon. Polygons are defined in a ESRI shapefile, points are in a list. This is how I make the test: OGRLayer *layer = ...
0
votes
0answers
22 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
53 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
24 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
134 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
66 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
59 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
78 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
91 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
185 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
89 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
32 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
144 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 ...
1
vote
1answer
54 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
237 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
224 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
124 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
60 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
71 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
130 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 ...