[GRASS-SVN] r60643 - grass/branches/releasebranch_7_0/vector/v.out.postgis

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 31 08:22:28 PDT 2014


Author: martinl
Date: 2014-05-31 08:22:28 -0700 (Sat, 31 May 2014)
New Revision: 60643

Modified:
   grass/branches/releasebranch_7_0/vector/v.out.postgis/create.c
Log:
v.out.postgis: do not ignore PROJ_EPSG if available
               (merge r60124 from trunk)


Modified: grass/branches/releasebranch_7_0/vector/v.out.postgis/create.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.out.postgis/create.c	2014-05-31 15:20:13 UTC (rev 60642)
+++ grass/branches/releasebranch_7_0/vector/v.out.postgis/create.c	2014-05-31 15:22:28 UTC (rev 60643)
@@ -12,6 +12,7 @@
 		    char **fid_column, char **geom_column)
 {
     int   i;
+    const char *epsg;
     char *filename, *conninfo;
     char buf[GPATH_MAX];
     FILE *fp;
@@ -52,6 +53,9 @@
     if (topo)
         G_set_key_value("topology", "yes", key_val);
 
+    /* is EPSG defined */
+    epsg = G_database_epsg_code();
+    
     /* extra options */
     if (options) {
 	char **tokens;
@@ -63,8 +67,13 @@
 		continue;
 	    }
 	    G_debug(1, "option: %s=%s", tokens[0], tokens[1]);
-            /* force upper case */
+            /* force lower case */
             G_str_to_lower(tokens[0]);
+
+            if (strcmp(tokens[0], "srid") && epsg)
+                G_warning(_("EPSG code (%s) defined for current location will be ignored"),
+                          epsg);
+            
 	    G_set_key_value(tokens[0], tokens[1], key_val);
 	    
 	    if (strcmp(tokens[0], "fid") == 0)
@@ -76,6 +85,10 @@
 	}
     }
     
+    /* check EPSG code if defined as an option */
+    if (epsg && !G_find_key_value("srid", key_val))
+        G_set_key_value("srid", epsg, key_val);
+        
     if (olink) {
         /* create a link for output feature table */
         G_set_key_value("link", "yes", key_val);



More information about the grass-commit mailing list