-- Basic syntax:
CALL SHPRead('/home/user/file.shp', 'tableName');
-- In the next two examples, we show what happens when we attempt to
-- read a SHP file with the wrong encoding, and how to fix it. Here
-- UTF-8 doesn't understand accented characters, so "Sévérac" is
-- displayed as "S".
CALL SHPRead('/home/user/COMMUNE.SHP', 'commune44utf',
'utf-8');
SELECT * FROM commune44utf LIMIT 2;
-- Answer:
-- | THE_GEOM | NOM |
-- | ----------------------------------------- | ------- |
-- | MULTIPOLYGON(((350075.2 6719771.8, | Puceul |
-- | 350072.7 6719775.5, 350073 6719780.7, | |
-- | 350075.2 6719771.8))) | |
-- | MULTIPOLYGON(((317341.5 6727021, | S |
-- | 317309.9 6727036.8, 317193.3 6727066.5, | |
-- | 317341.5 6727021))) | |
-- To fix this problem, we specify the right encoding:
CALL SHPRead('/home/user/COMMUNE.SHP', 'commune44iso',
'iso-8859-1');
SELECT * FROM commune44iso LIMIT 2;
-- Answer:
-- | THE_GEOM | NOM |
-- | ----------------------------------------- | ------- |
-- | MULTIPOLYGON(((350075.2 6719771.8, | Puceul |
-- | 350072.7 6719775.5, 350073 6719780.7, | |
-- | 350075.2 6719771.8))) | |
-- | MULTIPOLYGON(((317341.5 6727021, | Sévérac |
-- | 317309.9 6727036.8, 317193.3 6727066.5, | |
-- | 317341.5 6727021))) | |