]> granicus.if.org Git - postgis/commitdiff
converting a GEOMETRYCOLLECTION to wkb had the size of the wkb off by 9
authorDavid Blasby <dblasby@gmail.com>
Thu, 28 Jun 2001 17:52:15 +0000 (17:52 +0000)
committerDavid Blasby <dblasby@gmail.com>
Thu, 28 Jun 2001 17:52:15 +0000 (17:52 +0000)
bytes (size of the collection header).  Fixed.

git-svn-id: http://svn.osgeo.org/postgis/trunk@11 b70326c6-7e19-0410-871a-916f4a2858ee

examples/wkb_reader/comp
examples/wkb_reader/readwkb
examples/wkb_reader/readwkb.c
postgis_inout.c

index b915e13c96ddc44e00cc84a61197d1bb270c79e8..bf67b16d27ac634c2b1de9bed0ae550113673978 100644 (file)
@@ -1,2 +1,2 @@
-gcc -g -I/usr/include/pgsql -I/usr/local/include/pgsql -L/data3/postgresql-7.1.2/lib readwkb.c  -o readwkb -lpq
+gcc -g -I/data3/postgresql-7.1.2/include -I/usr/include/pgsql -I/usr/local/include/pgsql -L/data3/postgresql-7.1.2/lib readwkb.c  -o readwkb -lpq
 
index 6d5e5313c5f6eae63120ae9ce34298c415ff4bf4..659cec97aa7940d3be368f7a9f6f837ab6c0dd7f 100755 (executable)
Binary files a/examples/wkb_reader/readwkb and b/examples/wkb_reader/readwkb differ
index be40e62c871d057ec10181d6f8973465b5931300..33c07cdbe7650f37b86683539667e4efd956c0cc 100644 (file)
@@ -157,7 +157,7 @@ int WKB_OID;
        double  *double_val;
        char            *char_val;
        char            *wkb_val;
-       char            *table_name = "tt";
+       char            *table_name = "t";
        char            query_str[1000];
 
     /*
@@ -172,7 +172,7 @@ int WKB_OID;
         pgport = "5555";                                                
         pgoptions = "user=postgres";                    
         pgtty = NULL;                                                
-        dbName = "test1";
+        dbName = "t2";
        
 
 
@@ -217,7 +217,9 @@ int WKB_OID;
      * fetch rows from the pg_database, the system catalog of
      * databases
      */
-       sprintf(query_str, "DECLARE mycursor BINARY CURSOR FOR select interesting, comments, wkb_ndr(the_geom) as wkb from %s",table_name);
+       sprintf(query_str, "DECLARE mycursor BINARY CURSOR FOR select text(num), asbinary(the_geom,'ndr') as wkb from %s",table_name);
+
+       printf(query_str); printf("\n");
 
     res = PQexec(conn, query_str);
 
@@ -271,7 +273,7 @@ int WKB_OID;
                                double_val = (double *) PQgetvalue(res, row, field);
                                printf("%s: %g\n",field_name,*double_val);      
                        }
-                       if (field_type ==1043 )//varchar 
+                       if ( (field_type ==1043 ) || (field_type==25) )//varchar 
                        {
                                char_val = (char *) PQgetvalue(res, row, field);
                                printf("%s: %s\n",field_name,char_val); 
@@ -300,4 +302,4 @@ int WKB_OID;
     PQfinish(conn);
 
     return 0;
-}
\ No newline at end of file
+}
index f9df0bc3d8bd5ab412227079ea0309024f29a5b4..72b1f4e2581caed0b1298baf3a29fa607a38f534 100644 (file)
@@ -2490,7 +2490,7 @@ char *to_wkb_collection(GEOMETRY *geom, bool flip_endian, int32 *end_size)
        pfree( sizes);
 
                //total size of the wkb 
-       *end_size = total_size;
+       *end_size = total_size+9;