[GRASS-SVN] r55302 - grass/trunk/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Mar 10 11:42:22 PDT 2013
Author: martinl
Date: 2013-03-10 11:42:22 -0700 (Sun, 10 Mar 2013)
New Revision: 55302
Modified:
grass/trunk/lib/vector/Vlib/open.c
grass/trunk/lib/vector/Vlib/open_pg.c
Log:
vlib(pg): enable srid support
Modified: grass/trunk/lib/vector/Vlib/open.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open.c 2013-03-10 18:08:31 UTC (rev 55301)
+++ grass/trunk/lib/vector/Vlib/open.c 2013-03-10 18:42:22 UTC (rev 55302)
@@ -1211,6 +1211,12 @@
#endif
G_debug(1, "PG: geom_column = '%s'", pg_info->geom_column);
+ /* srid (default: 0) */
+ p = G_find_key_value("srid", key_val);
+ if (p)
+ pg_info->srid = atoi(p);
+ G_debug(1, "PG: srid = %d", pg_info->srid);
+
/* table name */
Map->fInfo.pg.table_name = G_store(Map->name);
}
Modified: grass/trunk/lib/vector/Vlib/open_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open_pg.c 2013-03-10 18:08:31 UTC (rev 55301)
+++ grass/trunk/lib/vector/Vlib/open_pg.c 2013-03-10 18:42:22 UTC (rev 55302)
@@ -328,7 +328,6 @@
struct Format_info_pg *pg_info;
struct field_info *Fi;
- struct Key_Value *projinfo, *projunits;
Fi = NULL;
@@ -346,14 +345,6 @@
G_debug(1, "V2_open_new_pg(): conninfo='%s' table='%s' -> type = %d",
pg_info->conninfo, pg_info->table_name, type);
- /* get spatial reference */
- projinfo = G_get_projinfo();
- projunits = G_get_projunits();
- pg_info->srid = 0; /* TODO */
- // Ogr_spatial_ref = GPJ_grass_to_osr(projinfo, projunits);
- G_free_key_value(projinfo);
- G_free_key_value(projunits);
-
/* determine geometry type */
switch (type) {
case GV_POINT:
@@ -833,6 +824,7 @@
result = PQexec(pg_info->conn, stmt);
if (!result || PQresultStatus(result) != PGRES_TUPLES_OK) {
+ G_warning("%s", PQresultErrorMessage(result));
PQclear(result);
Vect__execute_pg(pg_info->conn, "ROLLBACK");
return -1;
More information about the grass-commit
mailing list