[GRASS-SVN] r52037 - grass/trunk/vector/v.external.out
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jun 12 02:57:23 PDT 2012
Author: martinl
Date: 2012-06-12 02:57:23 -0700 (Tue, 12 Jun 2012)
New Revision: 52037
Modified:
grass/trunk/vector/v.external.out/link.c
grass/trunk/vector/v.external.out/status.c
grass/trunk/vector/v.external.out/v.external.out.html
Log:
v.external.out: new PG options - 'topology=on|off'
Modified: grass/trunk/vector/v.external.out/link.c
===================================================================
--- grass/trunk/vector/v.external.out/link.c 2012-06-12 03:57:14 UTC (rev 52036)
+++ grass/trunk/vector/v.external.out/link.c 2012-06-12 09:57:23 UTC (rev 52037)
@@ -13,7 +13,7 @@
{
int use_ogr;
char *filename, *pg_schema, *pg_fid, *pg_geom_name, *dsn;
- char *pg_spatial_index, *pg_primary_key;
+ char *pg_spatial_index, *pg_primary_key, *pg_topo;
FILE *fp;
struct Key_Value *key_val;
@@ -76,7 +76,7 @@
/* parse options for PG data format */
pg_schema = pg_fid = pg_geom_name = NULL;
- pg_spatial_index = pg_primary_key = NULL;
+ pg_spatial_index = pg_primary_key = pg_topo = NULL;
if (options && *options && !use_ogr) {
pg_schema = get_option_pg(options, "schema");
pg_fid = get_option_pg(options, "fid");
@@ -89,6 +89,10 @@
if (pg_primary_key) {
check_option_on_off("primary_key", &pg_primary_key);
}
+ pg_topo = get_option_pg(options, "topology");
+ if (pg_topo) {
+ check_option_on_off("topology", &pg_topo);
+ }
}
/* add key/value items */
if (dsn) {
@@ -115,6 +119,8 @@
G_set_key_value("spatial_index", pg_spatial_index, key_val);
if (pg_primary_key)
G_set_key_value("primary_key", pg_primary_key, key_val);
+ if (pg_topo)
+ G_set_key_value("topology", pg_topo, key_val);
}
/* save file - OGR or PG */
Modified: grass/trunk/vector/v.external.out/status.c
===================================================================
--- grass/trunk/vector/v.external.out/status.c 2012-06-12 03:57:14 UTC (rev 52036)
+++ grass/trunk/vector/v.external.out/status.c 2012-06-12 09:57:23 UTC (rev 52037)
@@ -35,6 +35,7 @@
int print_status_file(const char *file, int shell)
{
+ int i;
FILE *fp;
const char *p;
@@ -47,54 +48,32 @@
key_val = G_fread_key_value(fp);
fclose(fp);
+ /* check required options */
if (strcmp(file, "OGR") == 0) {
/* dsn (required) */
p = G_find_key_value("dsn", key_val);
if (!p)
G_fatal_error(_("OGR datasource (dsn) not defined"));
- print_key_value("dsn", p, shell);
/* format (required) */
p = G_find_key_value("format", key_val);
if (!p)
G_fatal_error(_("OGR format not defined"));
- print_key_value("format", p, shell);
-
- /* options */
- p = G_find_key_value("options", key_val);
- print_key_value("options", p, shell);
}
else { /* PG */
/* conninfo (required) */
p = G_find_key_value("conninfo", key_val);
if (!p)
G_fatal_error(_("PG connection info (conninfo) not defined"));
- print_key_value("conninfo", p, shell);
-
- /* format (hardcoded) */
- print_key_value("format", "PostgreSQL", shell);
-
- /* schema */
- p = G_find_key_value("schema", key_val);
- print_key_value("schema", p, shell);
-
- /* fid */
- p = G_find_key_value("fid", key_val);
- print_key_value("fid", p, shell);
-
- /* geometry_name */
- p = G_find_key_value("geometry_name", key_val);
- print_key_value("geometry_name", p, shell);
-
- /* spatial_index */
- p = G_find_key_value("spatial_index", key_val);
- print_key_value("spatial_index", p, shell);
-
- /* primary_key */
- p = G_find_key_value("primary_key", key_val);
- print_key_value("primary_key", p, shell);
+
+ /* force format */
+ print_key_value("format", "PostgreSQL", shell);
}
+ /* print all options */
+ for (i = 0; i < key_val->nitems; i++)
+ print_key_value(key_val->key[i], key_val->value[i], shell);
+
G_free_key_value(key_val);
return TRUE;
Modified: grass/trunk/vector/v.external.out/v.external.out.html
===================================================================
--- grass/trunk/vector/v.external.out/v.external.out.html 2012-06-12 03:57:14 UTC (rev 52036)
+++ grass/trunk/vector/v.external.out/v.external.out.html 2012-06-12 09:57:23 UTC (rev 52037)
@@ -41,7 +41,10 @@
<li><tt>GEOMETRY_NAME=<column></tt> name of column which will
be used for storing geometry data in feature table, default: <tt>geom</tt></li>
<li><tt>SPATIAL_INDEX=ON|OFF</tt> - enable/disable spatial index on geometry column, default: ON</li>
- <li><tt>PRIMARY_KEY=ON|OFF</tt> - enable/disable primary key on FID column, default: ON</li>
+ <li><tt>PRIMARY_KEY=ON|OFF</tt> - enable/disable primary key on FID column, default: ON</li>
+ <li><tt>TOPOLOGY=ON|OFF</tt> - enable/disable
+ native <a href="http://trac.osgeo.org/postgis/wiki/UsersWikiPostgisTopology">PostGIS
+ topology</a>, default: OFF</li>
</ul>
<p>
More information about the grass-commit
mailing list