[gdal-dev] Try to create a .bat for ogr2ogr
Bo Victor Thomsen
bo.victor.thomsen at gmail.com
Fri Aug 29 23:55:50 PDT 2014
João -
Try to get to ogr2ogr command to work (or not work) from GDAL
command-line environment (SDKShell.bat) with one shape file.
And don't depend on defaults in the database connection string, ie.
PG:"*host=localhost port=5432 *dbname='temp_gis' user='test_user'
password='test_pss'"
You might try to simply create a new table in stead of appending to an
existing table.
At a glance I suspect you have some kind of permission problem in the
database
Checkpoint 101:
1. Have you a Postgres/Postgis databaser server installed at localhost
and listening on port 5432 ?
2. Is your database user and password set correctly ?
3. Has you a database 'temp_gis' with PostGIS enabled running on the
local database server ?
4. Has you a schema 'temp' in the database and a table 'upload' in schema ?
5. Has the table the right structure and a geometry column ?
6. Does the database user has permission to write data to the table ?
I suspect that no. 5 or 6 is the culprit.
Regards
Bo Victor Thomsen
Aestas-GIS
Denmark
Den 29-08-2014 12:45, João Gaspar skrev:
> Hi guys,
>
> i'm giving the first steps in this kind of programming.
>
> So the scenario is:
>
> I have a lot of users that dump work shapfiles into a folder, then i
> need to upload this files to a database into a single table (at this
> time i'm testing the PostGIS).
>
> So I read some snippets code and some tutorials and i try to do the
> .bat but at this time i have some errors.
>
> Note: I put the name of user and password with dummy value :)
>
> The error that give me for the 2 test shapefiles that i try to import is:
>
> ERROR 1: Unable to write feature 0 from layer Polygon1.
>
> ERROR 1: Terminating translation prematurely after failed
> translation of layer Polygon1 (use -skipfailures to skip errors)
>
> ERROR 1: Unable to write feature 0 from layer Polygon2.
>
> ERROR 1: Terminating translation prematurely after failed
> translation of layer Polygon2 (use -skipfailures to skip errors)
>
> My actual code of the .bat is:
>
>
> @echo off
> for %%I in (inputs_pggis\*.shp) do (
> echo Import shapefile %%~nxI to schema temp.upload
> Tabela PostGIS ...
> ogr2ogr -append -update -f PostgreSQL PG:"dbname='temp_gis'
> user='test_user' password='test_pss'" inputs_pggis/%%~nxI -nln temp.upload
> )
>
>
> Best Regards,
> João
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140830/03345408/attachment.html>
More information about the gdal-dev
mailing list