The OGR Simple Features Library is a C++ open source library (and command line tools) providing access to vector file formats.
0
votes
0answers
20 views
Python OGR, psycopg, postgis - geometry is null when updating
I'm attempting a python script that takes data from a file and updates only the geometry and a key field in a post gis table. But no matter what I try the geometry always seems to be updated null.
...
0
votes
0answers
22 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
35 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 ...
0
votes
0answers
15 views
Using OGRLayer::GetNextFeature() in OGR/GDAL? [closed]
I am trying read features in a dgn file and convert to shape file. Everything is ok before I adding the last while loop. After adding this while loop, I can't exit the program. Please see my below ...
2
votes
1answer
51 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
26 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 ...
0
votes
0answers
49 views
ogr.GetDriverByName('FileGDB') returns None
I installed:
gdal-110-1600-x64-core.msi
GDAL-1.10.0.win-amd64-py2.7.msi
gdal-110-1600-x64-filegdb.msi
from www.gisinternals.com
I can open my gdb on the command line:
C:\data>ogrinfo ...
0
votes
0answers
29 views
code isn't creating an output file (ogr2ogr w/ python)
I have a python code that clips a shp file w/ a shp file using the gdal/ogr library. It seems to work but it does not create an output file.
import subprocess
# The features used to clip the input ...
2
votes
1answer
48 views
Error when using gdal/ogr and python to clip a “shp” file by a “shp” [duplicate]
I am new to the gdal/ogr library for python and I was wondering how to clip a shp file by another shp file. I think I am having trouble with the syntax. Thanks - Stefan
I keep getting a windows error ...
0
votes
1answer
35 views
Problem with showing Shape file in Geoserver
I have a number of Shape files from a customer.
I can read them with both ogrinfo and QGIS.
They don't have a prj-file, but I know that the projection is EPSG:3006.
When I add them as layers in ...
0
votes
0answers
21 views
How to check are there any OGRGeometry (polygons) within an OGRGeometry (polygon) ?
Please see my image:
I used the below statements to get Geometry:
OGRGeometry *poGeometry;
poGeometry = poFeature->GetGeometryRef();
Do you know how to check whether the Polygon 1 ...
0
votes
0answers
20 views
Asking about Convert Dgn to Shp and OGRLayer::SetSpatialFilter
I used the this function: ConvertDgnToShp
to convert my dgn file to shp file. But, after converting, I can't select(chose) the small polygon (that is contained in another polygon, I used ArcMap to ...
0
votes
1answer
32 views
Can't convert geometry from Dgn file to Shape file?
I am using below codes to try convert geometry from a Dgn file to Shape file. But, I can't exit the Feature reading loop. Are there anyone know why and how to fix it ? Please download the dgn file ...
0
votes
0answers
26 views
Invalid multipolygon resulting from union of valid multipolygons
I'm using python (2.7) and ogr (1.9.2) to merge a bunch of multipolygons together. On their own, all the multipolygons are valid. After I iterate over them using ogr's Union function, I end up with ...
1
vote
2answers
61 views
OGR Projection transformation error
I am trying to convert shapefile that was created by FME in EPSG:900913 to EPSG:3857 (I know its the same definition) with OGR in a script.
datasource = ogr.Open(os.path.join(dirname,shapefileName))
...
2
votes
0answers
25 views
How do I get the domain from an OGRSpatialReference?
I would like to know what the projected bounds are for a spatial reference using OGRSpatialReference. Is there some way to use the GetProjParm method to get this information?
An example of what ...
2
votes
1answer
82 views
R : convert a spatial polygon objet to spatial polygon data frame
My goal is to modify an existing shapefile by merging certain polygons.
After importing the shapefile and using the UnionSpatialPolygons command, I get the polygon outline that I want.
However, this ...
5
votes
1answer
138 views
Python - OGR: Transform coordinates from meter to decimal degrees
I have a point in a shapefile. The shapefile is in a WGS_1984_Web_Mercator Projected Coordinate System. I want to get the coordinates of that point in decimal degrees with GDAL/OGR in Python.
I am ...
0
votes
0answers
33 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
1answer
55 views
Batch convert OSM/PBF data
I need to import some OSM data about a region of Italy into a SHP file or Postgres DB, possibly with batch process.
I already use OGR2OGR to batch import data from SHP to Oracle and Postgres and I ...
1
vote
1answer
30 views
OGR UnionCascaded gives strange lines (flat polygons)
I'm using OGR to perform a union using UnionCascaded. All my polygons have been created by GDAL polygonize which ensures that all polygons follow pixel edges and should therefore align nicely. But I ...
3
votes
3answers
87 views
How to computational efficiently check if there are any overlapping polygons in a group of polygons?
I need to do some processing with groups of polygons. If any of the polygons in the group overlaps other polygon the result is unpredictable and don't throw any error. So, I need to detect if there is ...
0
votes
0answers
27 views
NYC Building Perimeter Shapefile after 2011
I've been using the following NYC building perimeter shapefile from the DOTT for some work. This file however dates back to 2010. Is there a newer one available, and if so where?
I have found this ...
1
vote
1answer
56 views
GDAL SQL syntax to add field an put values
I try to make a new field in my attribute table and put in values from another field after converting from character to integer but can't get the right syntax. I run this as shell-script in MSYS.
cd ...
0
votes
0answers
34 views
Is QGIS OGR plug-in data provider (based on Postgres) limited to 500 features in layer?
I developed a plug-in based on OGR. It works fine but when I want to add a vector data (using my plug-in) I get 1449 features (with 76 columns) in my layer. Then I select this layer and load it.
...
1
vote
1answer
95 views
Creating prepared geometries with OGR from Python
Is it possible to create a prepared geometry object using the Python SWIG geos.ogr module? It seems that Shapely and GeoDjango both have this functionality, but I can't see any mention of it in the ...
2
votes
3answers
103 views
How to test if geometry is inside another?
I need to tell whether geometries from a shapefile are inside other geometries or not.
For example, I want to test if there are trees (represented as points in trees.shp) inside the urban areas ...
1
vote
0answers
31 views
how to get correct geo reference system for a VMap
I am new to GIS, trying to read the GeoRef System for VMap by using the following code:
OGRSpatialReference *ref = layer->GetSpatialRef();
if( ref )
{
QString georefSystem = ...
10
votes
1answer
122 views
How to rename field names in a shapefile from the commandline?
I need to rename the field names (attributes) in a shapefile. Is there an easy way to do this from the command line?
0
votes
4answers
176 views
preferred source format for OGR conversion to GeoJSON
I'm relatively new to OGR and GIS in general. Most of the sources I look at give a choice of ESRI shapefile and MapInfo formats. I'm using ogr2ogr to convert these to GeoJSON for import into ...
2
votes
0answers
53 views
traversing KML files with ogr python
i'm new to OGR processing and KML format so be gentle:
i've got a series of KML files all containing multiple regions partitioning a larger area in each. i also have a series of geocoded points for ...
2
votes
1answer
93 views
OGR - Weird GeomType -2147483645 on polygon shapefile
I am trying to import a shapefile (multipolygon) in an app with ogr but I got an error about invalid geom type. If I inspect the data with ogr like this:
datasource = ogr.Open("c:\\temp\\data.shp")
...
0
votes
1answer
142 views
OGR OSM-driver unable to open datasource
I want to read an OSM file with OGR. I use Version GDAL 1.9.1, released 2012/05/15.
To read a SQLITE file works fine:
$ ogrinfo test.sqlite
INFO: Open of `test.sqlite'
using driver `SQLite' ...
1
vote
4answers
103 views
Get vector features inside a specific extent
The problem:
I have a very large vector layer with many features and a much smaller raster layer in a defined region. I want to get only those vector features which are within the raster layers ...
0
votes
1answer
47 views
OGR shows no layers
I have an ESRI File Geodatabase (FileGDB) (size is 15+GB), which has over 10 layers, when I open it up in ArcGIS, everything seems to be working.
I want to move this database to postgreSQL with OGR ...
0
votes
0answers
35 views
QgsVectorLayer: How to load files containing multiple layers
I’m trying to load all layers from a ZIP-file using the OGR-Dataprovider.
vlayer = QgsVectorLayer("/path/file.zip", "ZIP-Layer", "ogr")
will load only the first layer.
Any idea how to load all ...
2
votes
1answer
135 views
better way to duplicate a layer using ogr in python?
I'm splitting a large shapefile into many smaller ones using ogr. I'd like to just copy all of the field and layer config information from the original. Here's how I'm doing it now:
src = ...
2
votes
1answer
105 views
Need help assigning values to field using OGR in python
I've got a similar question to this one How to programatically populate a shapefile field with polygon areas in OGR?, but the solution doesn't seem to be working for me. I am trying to import a ...
0
votes
0answers
49 views
How to expand Ogr Sql Functionality
I'm using Ogr2Ogr for some geometric & querying operations by storing the results in SQLite files.In SQLite there are some functions I use.For that,I need to extent sql functionality.For that I'm ...
0
votes
0answers
52 views
Using GDAL/OGR exes in php
could you point me in the next logical direction? I wanted to use the gdal and run the exe commands through my web application, but have no clue what the next step should be after running the ...
2
votes
1answer
88 views
need help for script checking topology using ogr in python
My main goal is to create a new feature indicating if the line features intersect each other as well as if they are not connected to a feature.
My problem is how to identify the intersecting and not ...
0
votes
2answers
42 views
OGR GetX() returns always zero
I am trying to get the first x-coordinates of a polygon. However I only get zero in return. What could cause that?
import os, sys, gdal, ogr
from gdalconst import *
driver = ...
2
votes
1answer
142 views
Convex Quadrilateral Polygons subdivision in equal parts using Python / OGR
Consider an irregular polygon (P) which has four vertices.
I would like to subdivide P into smaller polygons as shown here http://i.stack.imgur.com/4SKhB.jpg
In the old days I was using ArcGIS 9.3 ...
2
votes
1answer
51 views
OGR CreateLayer returns TypeError
I'm trying to create a shapefile layer based on the spatial projection of an already existing raster. (Ultimately, this will be used in gdal.Polygonize to get a shape from my raster data.) However, I ...
3
votes
1answer
101 views
Python - OGR: Distance different than in ArcGIS
I want to determine the shortest distance between a point and a line. I use the following Python script to do so. If I compare the result of the script with the result of ArcMap's Near Analysis, I get ...
3
votes
1answer
92 views
OGR Info - Check for spatial index?
If we want to get information about a vector layer (shapefile for example) we could use ogrinfo:
ogrinfo -so myshapefile.shp mylayer
This returns a lot of pertinent information about the shapefile. ...
2
votes
0answers
64 views
Custom python datasource to QGIS
I'm working on a homebrew spatial feature data format, and using Python to write it's API.
It occoured to me that use some tool like QGIS to display my data would be very nice to have, for debug/test ...
0
votes
1answer
250 views
Installing GDAL with Java Bindings (gdal.jar) on Ubuntu 12.10
I am trying to build a postgis importer for mutliple shapefiles. After geotools took orders of magnitude longer than shp2pgsql to import my data, I decided to attempt to use the java bindings to GDAL ...
2
votes
1answer
51 views
QGIS QgsOgrProvider library
I asked a question here:
http://stackoverflow.com/questions/14790463/qgis-copy-layer-in-c-plugin
and I was suggested to find the library which provides QgsOgrProvider::createEmptyLayer() function. Can ...
2
votes
1answer
113 views
How to debug ogr2ogr ERROR 1: Did not get at least 2 values or invalid number of set of coordinates?
I'm trying to convert a government data contour GML (http://geo.data.linz.gv.at/katalog/geodata/hoehenschichten/2011/1m-Hoehenschichten.gml) to Shapefile.
It seems like it was created by FME:
...


