Explorar o código

fix https://trac.osgeo.org/grass/ticket/2436 (v.out.postgis: Unsupported geometry type / Unable to write feature in vector map)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@62360 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa %!s(int64=10) %!d(string=hai) anos
pai
achega
5738022db0
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      lib/vector/Vlib/write_pg.c

+ 7 - 1
lib/vector/Vlib/write_pg.c

@@ -1081,6 +1081,7 @@ int create_pg_layer(struct Map_info *Map, int type)
         pg_info->feature_type = SF_LINESTRING;
         pg_info->feature_type = SF_LINESTRING;
         break;
         break;
     case GV_BOUNDARY:
     case GV_BOUNDARY:
+    case GV_AREA:
         pg_info->feature_type = SF_POLYGON;
         pg_info->feature_type = SF_POLYGON;
         break;
         break;
     case GV_FACE:
     case GV_FACE:
@@ -1215,7 +1216,12 @@ off_t write_line_sf(struct Map_info *Map, int type,
     /* get category & check for attributes */
     /* get category & check for attributes */
     cat = -1;
     cat = -1;
     if (cats->n_cats > 0) {
     if (cats->n_cats > 0) {
-        int field = pg_info->fi->number;
+        int field;
+        
+        if (pg_info->fi)
+            field = pg_info->fi->number;
+        else
+            field = 1;
         
         
         if (!Vect_cat_get(cats, field, &cat))
         if (!Vect_cat_get(cats, field, &cat))
             G_warning(_("No category defined for layer %d"), field);
             G_warning(_("No category defined for layer %d"), field);