1
vote
1answer
200 views

Import shp to Postgis using Python and ogr

I just export a Postgis Table to shp using this tips but I'm not able to import a shp to Postgis using the same library(ogr). Any idea? Thanks a lot f.
3
votes
3answers
557 views

PostGIS: parse geometry wkb with OGR

I'm trying to pull a LineString geometry out of PostGIS and parse it with OGR (python bindinds). from osgeo import ogr import psycopg2 connection = psycopg2.connect("...") cursor = ...
0
votes
1answer
250 views

Will MapInfo only read PostGIS data that has been loaded via EasyLoader?

NMZ says in this thread that MapInfo will only read data in PostGIS that has been loaded by MapInfo's EasyLoader. I wasn't sure if this was still the case so I've loaded data into postgis via ogr2ogr ...
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 ...
3
votes
2answers
230 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 ...
4
votes
1answer
199 views

How to use -lco options in gdal_contour?

I'm trying to create contours from geotiff raster with gdal_contour. My output format is Postgresql and I would like to ovewrite the existing table. When I do: gdal_contour -a 1 -f PostgreSQL -i 50 ...
2
votes
1answer
317 views

How to bulk delete shapefile columns?

I have shape-file with next attribute table: - name of features, unique number for each feature of layer I must split shape-file by NAME field, but in result in attribute tables of layers should be ...
6
votes
1answer
441 views

Geometry errors when importing data from ESRI file geodatabase to PostGIS

When I run the following command to import by data from an ESRI fgdb to postgis... ogr2ogr -f "PostgreSQL" -a_srs "EPSG:28355" -t_srs "EPSG:3857" PG:"dbname=tp_test user=postgres port=54321 ...
4
votes
2answers
517 views

How to programmatically create exports from PostGIS database into different file formats (e.g. shapefile, dxf, dgn,…)?

Is there a kind of wrapper/library written in python which would enable me to programatically create exports from postgis database into different file formats (most common being, shapefile, dxf, ...
3
votes
2answers
464 views

Why does Ogr2Ogr Postgres import fail?

I have a lot of S57 files that need to be imported to PostgresDB. The process takes over 2 hours. In order to improve performance, I have tried using PG_USE_COPY to use copy instead of DB inserts. I ...
2
votes
2answers
798 views

Export from PostGIS to SpatiaLite?

My PostGIS database contains OSM data from my country. For transportation reasons I want to export a spatial view I created from that data to a SpatiaLite database. Is there any way to directly ...
7
votes
2answers
454 views

How to catch PostgreSQL/PostGIS errors in GDAL/OGR Python bindings?

Is it possible to catch PostgreSQL output error messages in OGR after a query has failed? For example conn.ExecuteSQL('SELECT * FROM non_existing_table;') In Postgres this returns an error ...
3
votes
1answer
885 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 ...
9
votes
2answers
2k views

Is it possible to get the EPSG value from an OSR SpatialReference class using the OGR Python API?

When reading a layer from a OGR PostGIS connection I can get the SpatialReference of the layer, but is it possible to get the EPSG value? Is there any documentation on this? For example: lyr = ...
2
votes
1answer
746 views

Exporting PostgreSQL table to FileGDB: wkbUnknown layer geometry type

I'm attempting to export a PostGIS (1.5.3) database table as a File geodatabase using the new FileGDB OGR / GDAL 1.9.0 driver: $ ogr2ogr -overwrite -sql "SELECT * from db_pts LIMIT 1" \ -f ...
4
votes
1answer
930 views

How to assign OGR geometry a spatial reference when writing to a new layer using the Python API?

I'm using the Python OGR API to add new features to a PostGIS layer. However, despite setting the geometry spatial reference, when the geometry is written out the spatial reference is missing. This is ...
5
votes
2answers
547 views

Accessing non-spatial PostgreSQL tables using OGR Python bindings

When connecting to PostgreSQL/PostGIS using the OGR Python bindings is it possible to get non-spatial table names (i.e. OGR layers) from the connection? Currently, doing: conn = ogr.Open("PG: ...
7
votes
1answer
1k views

Help with PostGIS polygon geometry - non-closed rings

I've picked up a copy of the super-wicked book 'Python Geospatial Development' by Erik Westra (Amazon link), and I'm working through it. Currently, it's teaching me to load GSHHS coastline data from a ...
1
vote
4answers
3k views

ogr2ogr, convert from shp to postgis error

I am trying to import a shapefile into PostGIS using the ogr2ogr tools that are built into the FWTools package. In my import process I am receiving an error that I don't know how to deal with. ERROR ...
9
votes
3answers
1k views

getting dxf files out of PostgreSQL

I've successfully loaded a bunch of shapefiles into a PostGIS database. I would like to be able to retrieve specific geometry and layers as dxf files based on SQL queries. I'm using PostGIS, GDAL, ...
5
votes
2answers
1k views

Geodatabase to PostGIS character encoding

Similar to another question I posted previously, I'm trying to import datasets from Esri geodatabases into a PostGIS database directly, and inside the data there are greek letters and symbols that are ...