[GRASS-SVN] r52570 - grass/trunk/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Aug 6 14:34:28 PDT 2012
Author: martinl
Date: 2012-08-06 14:34:28 -0700 (Mon, 06 Aug 2012)
New Revision: 52570
Modified:
grass/trunk/lib/vector/Vlib/close.c
grass/trunk/lib/vector/Vlib/open.c
Log:
vlib: check GRASS_VECTOR_PGFILE (defined by v.out.postgis) when opening/creating vector map
Modified: grass/trunk/lib/vector/Vlib/close.c
===================================================================
--- grass/trunk/lib/vector/Vlib/close.c 2012-08-06 20:10:39 UTC (rev 52569)
+++ grass/trunk/lib/vector/Vlib/close.c 2012-08-06 21:34:28 UTC (rev 52570)
@@ -81,7 +81,8 @@
write mode on level 2 */
if (strcmp(Map->mapset, G_mapset()) == 0 &&
Map->support_updated &&
- Map->plus.built == GV_BUILD_ALL) {
+ Map->plus.built == GV_BUILD_ALL &&
+ getenv("GRASS_VECTOR_PGFILE") == NULL) { /* GRASS_VECTOR_PGFILE defined by v.out.postgis */
unlink_file(Map, GV_TOPO_ELEMENT); /* topo */
@@ -119,7 +120,8 @@
/* NOTE: also close sidx for GV_FORMAT_OGR if not direct OGR access */
if (Map->format != GV_FORMAT_OGR_DIRECT &&
Map->plus.Spidx_built == TRUE &&
- Map->plus.built == GV_BUILD_ALL)
+ Map->plus.built == GV_BUILD_ALL &&
+ getenv("GRASS_VECTOR_PGFILE") == NULL) /* GRASS_VECTOR_PGFILE defined by v.out.postgis */
fclose(Map->plus.spidx_fp.file);
}
Modified: grass/trunk/lib/vector/Vlib/open.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open.c 2012-08-06 20:10:39 UTC (rev 52569)
+++ grass/trunk/lib/vector/Vlib/open.c 2012-08-06 21:34:28 UTC (rev 52570)
@@ -737,7 +737,8 @@
else
Map->format = GV_FORMAT_NATIVE;
- if (Map->format != GV_FORMAT_OGR_DIRECT) {
+ if (Map->format != GV_FORMAT_OGR_DIRECT &&
+ getenv("GRASS_VECTOR_PGFILE") == NULL) { /* GRASS_VECTOR_PGFILE defined by v.out.postgis */
G_debug(2, " using non-direct format");
/* check if map already exists */
@@ -776,7 +777,8 @@
Map->plus.spidx_with_z = Map->plus.with_z = Map->head.with_z = (with_z != 0);
if ((*Open_new_array[Map->format][1]) (Map, name, with_z) < 0) {
- Vect_delete(name); /* clean up */
+ if (getenv("GRASS_VECTOR_PGFILE") == NULL) /* GRASS_VECTOR_PGFILE defined by v.out.postgis */
+ Vect_delete(name); /* clean up */
return -1;
}
@@ -1143,7 +1145,7 @@
ogr_info->layer_name = G_store(Map->name);
}
- def_file = getenv("GRASS_VECTOR_PGFILE");
+ def_file = getenv("GRASS_VECTOR_PGFILE"); /* GRASS_VECTOR_PGFILE defined by v.out.postgis */
if (G_find_file2("", def_file ? def_file : "PG", G_mapset())) {
/* PostGIS */
if (Map->fInfo.ogr.driver_name) {
More information about the grass-commit
mailing list