SPLIT & character encoding problem?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

SPLIT & character encoding problem?

David Epstein
Hello,

I have several shapefiles originally created on a windows machine running in Hebrew. I think there is some sort of character encoding problem but am not sure how to fix it. Any help would be appreciated!

Please note that these files will load into qgis using the load vector layer command. Below, please find the detailed output for both SPLIT and  shp2pgsql.

thank you in advance,
-david



SPLIT (which does work for files created under English windows)
-----------------------------------------------------------------------------------------------------------
Problem inserting features from file:
/home/davideps/GIS/MUNITSIPALI.shp
The database gave an error while executing this SQL:
SELECT AddGeometryColumn('public', 'MUNITSIPALI', 'the_geom', -1, 'MULTIPOLYGON', 2)
The error was:
lation "public.MUNITSIPALI" does not exist
CONTEXT:  SQL statement "ALTER TABLE public."MUNITSIPALI" ADD COLUMN the_geom geometry "
PL/pgSQL function "addgeometrycolumn" line 86 at execute statement
SQL statement "SELECT AddGeometryColumn('', $1 , $2 , $3 , $4 , $5 , $6 )"
PL/pgSQL function "addgeometrycolumn" line 4 at SQL statement

shp2pgsql
-------------
shp2pgsql -s 2039 URBANI.shp urban_areas | psql spatialtest

Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
BEGIN
ERROR:  invalid byte sequence for encoding "UTF8": 0xf9
HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  invalid byte sequence for encoding "UTF8": 0xf9
HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".

Just guessing, I also tried this...
----------------------------------------
shp2pgsql -s 2039 -WUTF8 URBANI.shp urban_areas | psql spatialtest

Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
utf8: Invalid or incomplete multibyte or wide characterSET

Reply | Threaded
Open this post in threaded view
|

Re: SPLIT & character encoding problem?

David Epstein
Hi everyone,

I'm still working on this and am not actually sure the character encoding is causing the problem. According to http://tlt.psu.edu/suggestions/international/web/encoding/05nonroman.html, the coding for hebrew windows should be similar to ISO-8859-8. But, I'm getting a permission denied error in the geometry column even though I am the owner of the database... I've pasted text from the terminal when I run shp2pgsql and also from the postgresql log file. Any help would be appreciated!

-david


-->sudo shp2pgsql -s 2039 -W ISO-8859-8 URBANI.shp urban_areas | psql spatialtest

Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
SET
BEGIN
NOTICE:  CREATE TABLE will create implicit sequence "urban_areas_gid_seq" for serial column "urban_areas.gid"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "urban_areas_pkey" for table "urban_areas"
CREATE TABLE
ERROR:  permission denied for relation geometry_columns
CONTEXT:  SQL statement "DELETE FROM geometry_columns WHERE
                f_table_catalog = '' AND f_table_schema = 'public' AND f_table_name = 'urban_areas' AND f_geometry_column = 'the_geom'"
PL/pgSQL function "addgeometrycolumn" line 94 at execute statement
SQL statement "SELECT AddGeometryColumn('', $1 , $2 , $3 , $4 , $5 , $6 )"
PL/pgSQL function "addgeometrycolumn" line 4 at SQL statement
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
WARNING:  nonstandard use of \' in a string literal
LINE 1: ...VALUES ('8.88287388491e+003','1.23130983450e+006','בוענה נז\...
                                                             ^
HINT:  Use '' to write quotes in strings, or use the escape string syntax (E'...').
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block



-->sudo tail -n 50 /var/log/postgresql/postgresql-8.2-main.log

2008-01-09 10:35:25 IST HINT:  Use the escape string syntax for escapes, e.g., E'\r\n'.
2008-01-09 10:35:25 IST WARNING:  nonstandard use of escape in a string literal at character 84
2008-01-09 10:35:25 IST HINT:  Use the escape string syntax for escapes, e.g., E'\r\n'.
2008-01-09 10:49:05 IST NOTICE:  CREATE TABLE will create implicit sequence "urban_areas_gid_seq" for serial column "urban_areas.gid"
2008-01-09 10:49:05 IST NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "urban_areas_pkey" for table "urban_areas"
2008-01-09 10:49:05 IST ERROR:  permission denied for relation geometry_columns
2008-01-09 10:49:05 IST CONTEXT:  SQL statement "DELETE FROM geometry_columns WHERE
                        f_table_catalog = '' AND f_table_schema = 'public' AND f_table_name = 'urban_areas' AND f_geometry_column = 'the_geom'"
        PL/pgSQL function "addgeometrycolumn" line 94 at execute statement
        SQL statement "SELECT AddGeometryColumn('', $1 , $2 , $3 , $4 , $5 , $6 )"
        PL/pgSQL function "addgeometrycolumn" line 4 at SQL statement
2008-01-09 10:49:05 IST STATEMENT:  SELECT AddGeometryColumn('','urban_areas','the_geom','2039','MULTIPOLYGON',2);
2008-01-09 10:49:05 IST ERROR:  current transaction is aborted, commands ignored until end of transaction block
2008-01-09 10:49:05 IST STATEMENT:  INSERT INTO "urban_areas" ("shape_leng","shape_area","שם_הישוב","הערות","הסבר",the_geom) VALUES ('9.06802995385e+003','1.01826276165e+006','עילבון','ישוב',NULL,'SRID=2039;010600000001 [I deleted several lines of this] 00000001030000001C8CE22641');
2008-01-09 10:49:05 IST ERROR:  current transaction is aborted, commands ignored until end of transaction block

Reply | Threaded
Open this post in threaded view
|

Re: SPLIT & character encoding problem?

Micha Silver
Hello David:


I also think you have a permissions problem. See below...


davideps wrote:

> Hi everyone,
>
> I'm still working on this and am not actually sure the character encoding is
> causing the problem. According to
> http://tlt.psu.edu/suggestions/international/web/encoding/05nonroman.html,
> the coding for hebrew windows should be similar to ISO-8859-8. But, I'm
> getting a permission denied error in the geometry column even though I am
> the owner of the database... I've pasted text from the terminal when I run
> shp2pgsql and also from the postgresql log file. Any help would be
> appreciated!
>
> -david
>
>
> -->sudo shp2pgsql -s 2039 -W ISO-8859-8 URBANI.shp urban_areas | psql
> spatialtest
>
> Shapefile type: Polygon
> Postgis type: MULTIPOLYGON[2]
> SET
> BEGIN
> NOTICE:  CREATE TABLE will create implicit sequence "urban_areas_gid_seq"
> for serial column "urban_areas.gid"
> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
> "urban_areas_pkey" for table "urban_areas"
> CREATE TABLE
> ERROR:  permission denied for relation geometry_columns
>  
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check the grants on geometry_columns. i.e. in psql do:

geodata=> \z geometry_columns;
                       Access privileges for database "geodata"
 Schema |       Name       | Type  |                Access privileges
--------+------------------+-------+--------------------------------------------------
 public | geometry_columns | table |
{postgres=arwdRxt/postgres,dba=arwdRxt/postgres}
(1 row)

You probably should have "ALL PRIVILEGES" (arwdRxt) on the
geometry_columns table for whatever database user is trying to do the
shp2pgsql insert.

Cheers,
Micha

--
Micha Silver
Arava Development Co, Sapir, Israel
tel: +972(8)6592270
cell: +972(52)3665918

_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: SPLIT & character encoding problem?

David Epstein
Thank you!
-david


Quoting "Micha Silver (via Nabble)" <[hidden email]>:

>
>
>
> Hello David:
>
>
> I also think you have a permissions problem. See below...
>
>
> davideps wrote:
>
>> Hi everyone,
>>
>> I'm still working on this and am not actually sure the character encoding is
>> causing the problem. According to
>> http://tlt.psu.edu/suggestions/international/web/encoding/05nonroman.html,
>> the coding for hebrew windows should be similar to ISO-8859-8. But, I'm
>> getting a permission denied error in the geometry column even though I am
>> the owner of the database... I've pasted text from the terminal when I run
>> shp2pgsql and also from the postgresql log file. Any help would be
>> appreciated!
>>
>> -david
>>
>>
>> -->sudo shp2pgsql -s 2039 -W ISO-8859-8 URBANI.shp urban_areas | psql
>> spatialtest
>>
>> Shapefile type: Polygon
>> Postgis type: MULTIPOLYGON[2]
>> SET
>> BEGIN
>> NOTICE:  CREATE TABLE will create implicit sequence "urban_areas_gid_seq"
>> for serial column "urban_areas.gid"
>> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
>> "urban_areas_pkey" for table "urban_areas"
>> CREATE TABLE
>> ERROR:  permission denied for relation geometry_columns
>>
>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Check the grants on geometry_columns. i.e. in psql do:
>
> geodata=> \z geometry_columns;
>                        Access privileges for database "geodata"
>  Schema |       Name       | Type  |                Access privileges
> --------+------------------+-------+--------------------------------------------------
>  public | geometry_columns | table |
> {postgres=arwdRxt/postgres,dba=arwdRxt/postgres}
> (1 row)
>
> You probably should have "ALL PRIVILEGES" (arwdRxt) on the
> geometry_columns table for whatever database user is trying to do the
> shp2pgsql insert.
>
> Cheers,
> Micha
>
> --
> Micha Silver
> Arava Development Co, Sapir, Israel
> tel: +972(8)6592270
> cell: +972(52)3665918
>
> _______________________________________________
> Qgis-user mailing list
> [hidden email]
> http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user
>
>
> ______________________________________
>
> This email is a reply to your post @  
> http://n2.nabble.com/SPLIT---character-encoding-problem--tp2048201p2048203.html
> You can reply by email or by visting the link above.
>
>