Просмотр исходного кода

v.out.postgis: rename file (follow naming conventions)
remove create_table() - table is created automatically when writing new feature to the output


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@55853 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 12 лет назад
Родитель
Сommit
4f0324f183

vector/v.out.postgis/options.c → vector/v.out.postgis/args.c


+ 0 - 21
vector/v.out.postgis/create.c

@@ -7,27 +7,6 @@
 
 static void file_handler(void *);
 
-void create_table(struct Map_info *In, struct Map_info *Out)
-{
-    int type;
-    struct Format_info_pg *pg_info;
-
-    pg_info = &(Out->fInfo.pg);
-    if (pg_info->feature_type != SF_UNKNOWN)
-        return;
-    
-    /* create PostGIS table if doesn't exist
-       determine feature type from the first feature */
-    Vect_rewind(In);
-    Vect_set_constraint_type(In, GV_POINT | GV_LINES);
-    type = Vect_read_next_line(In, NULL, NULL);
-    Vect_rewind(In);
-    
-    if (Vect_write_line(Out, type, NULL, NULL) < 0)
-        G_fatal_error(_("Unable to create PostGIS layer <%s>"),
-                      Vect_get_finfo_layer_name(Out));
-}
-
 char *create_pgfile(const char *dsn, const char *schema, const char *olink,
                     char **options, int topo,
 		    char **fid_column, char **geom_column)

+ 3 - 4
vector/v.out.postgis/local_proto.h

@@ -11,14 +11,13 @@ struct flags {
     struct Flag *table, *topo;
 };
 
+/* args.c */
+void define_options(struct params *, struct flags *);
+
 /* create.c */
-void create_table(struct Map_info *, struct Map_info *);
 char *create_pgfile(const char *, const char *, const char *, char **, int,
 		    char **, char **);
 
-/* options.c */
-void define_options(struct params *, struct flags *);
-
 /* table.c */
 void check_columns(const struct Map_info *, const char *, const char *, const char *);
 

+ 2 - 8
vector/v.out.postgis/main.c

@@ -6,7 +6,7 @@
  *
  * PURPOSE:      Converts GRASS vector map layer to PostGIS
  *
- * COPYRIGHT:    (C) 2012 by Martin Landa, and the GRASS Development Team
+ * COPYRIGHT:    (C) 2012-2013 by Martin Landa, and the GRASS Development Team
  *
  *               This program is free software under the GNU General
  *               Public License (>=v2). Read the file COPYING that
@@ -135,13 +135,7 @@ int main(int argc, char *argv[])
     if (!flags.table->answer)
         Vect_copy_map_dblinks(&In, &Out, TRUE);
 
-    /* create PostGIS layer */
-    create_table(&In, &Out);
-    
-    if (flags.topo->answer) 
-        Vect_build_partial(&Out, GV_BUILD_NONE); /* upgrade level to 2 */
-    
-    /* copy vector features */
+    /* copy vector features & create PostGIS table*/
     if (Vect_copy_map_lines_field(&In, field, &Out) != 0)
         G_fatal_error(_("Copying features failed"));