Hello everybody :) I`m trying to make ArcGis connector to PostGIS 
with multiuser editing ability.The main idea that PostGis layer is 
dumped into shapefile and i handle all changes made by user and when user 
saves edits I overwrite(or delete/create) features that has been changed at 
this edits session by current user. All is amostly perfect but I`ve met 
some serious problems with dumper. At first I wanted to create own
but I met issue with ASTEXT() function that returned a broken string in some 
multipolygons. I can`t understand where is a bug .ASTEXT(the_geom) returned 
normal string. But when I`m trying to set this value to some field or 
dump it into some variable ,the string became broken.
The dicussion of this bug
http://postgis.refractions.net/bugs/bug.php?op=show&bugid=151
  Then I decided to use standart pgsql2shp to dump shapefile, but i`ve noticed 
strange percularity that the size of text fields equal to max sizeof values 
in this field so if where is no values in the field it`s size is 1. I decided 
to fix this and recompile pgsql2shp. I found changed string field size 
here(in pgsql2shp.c)
        
//str 772
if ( (type == 1042 || type == 1043) && mod != -1 )
                        {
                                size = mod-4; /* 4 is header size */
                        }
                        else
                        {
                                size = getMaxFieldSize(conn, schema,
                                        table, fname);
                                if ( size == -1 ) return 0;
                                if ( ! size ) size = 32;
                                /* might 0 be a good size ? */
                        }
                }

                if ( size > MAX_DBF_FIELD_SIZE )
                {
                        fprintf(stderr, "Warning: values of field '%s' "
                                "exceeding maximum dbf field width (%d) "
                                "will be truncated.\n",
                                fname, MAX_DBF_FIELD_SIZE);
                        size = MAX_DBF_FIELD_SIZE;
                }

/*printf( "FIELD_NAME: %s, SIZE: %d\n", field_name, size); */

                /* generic type (use string representation) */
                if(DBFAddField(dbf, field_name, FTString, size, 0) == -1)  
--here i changed 
size to 255
                {
                        fprintf(stderr, "Error - String field could not "
                                        "be created.\n");
                        return 0;
                }   
//str 807


but nothing changed.Fields size=max size of is value




Dear Users and Developers I want to ask You
"What am I doing wrong in pgsql2shp?"
"What is the reason of ASTEXT() function issue? and what to do to fix it?"
"Is there any method to get feature coords without ASTEXT() function?"
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to