Your Update statement isn't correct (see
http://www.sqlite.org/lang_update.html).
Your expression in parentheses is requesting multiple records, but
expressions in SQLite truncate the recordset to the first record
returned. Therefore, your inserting the first record over and over
again. Maybe this? (but I often use temp tables instead, since SQLite
doesn't allow FROM clauses in UPDATE statements; plus the indexes will
work better):
UPDATE my_table SET geom = (SELECT g.geom FROM my_shape As g WHERE
g.id = my_table.grid_id);
see this link:
http://sqlite.phxsoftware.com/forums/p/1708/7238.aspx
Good Luck
-Mark
On Dec 15, 4:30 pm, Jose Gomez-Dans <
jgomezd...@gmail.com> wrote:
> 2009/12/15 markb <
brad.markf...@gmail.com>
>
> > I think what your looking for is this:
> >
http://www.gaia-gis.it/spatialite/resources.html
> > init_spatialite-2.3.sql
>
> OK, this is correct. Still a problem left, but so far here's the whole
> procedure (hopefully for reference for somebody else):
>
> *.read init_spatialite-2.3.sql utf-8
> .loadshp <path> <table> <utf-8> <srid> <column_name>
> SELECT AddGeometryColumn('<my_table>', 'geom', 4326, 'POLYGON', 2);
> UPDATE my_table SET geom=( SELECT g.geom FROM my_table d, my_shape g WHERE
> d.grid_id=
g.id) ;
> *
> However, the geom column in my_table is set to one single value. The select
> statement shows the right results, e.g.,
> *spatialite> SELECT astext(g.geom) FROM my_table d, my_grid g WHERE
> d.grid_id=
g.id limit 14;*
> POLYGON((8.5 63.5, 8.5 64, 9 64, 9 63.5, 8.5 63.5))
> POLYGON((8.5 63.5, 8.5 64, 9 64, 9 63.5, 8.5 63.5))
> POLYGON((8.5 63.5, 8.5 64, 9 64, 9 63.5, 8.5 63.5))
> POLYGON((8.5 63.5, 8.5 64, 9 64, 9 63.5, 8.5 63.5))
> POLYGON((8.5 63.5, 8.5 64, 9 64, 9 63.5, 8.5 63.5))
> POLYGON((8.5 63.5, 8.5 64, 9 64, 9 63.5, 8.5 63.5))
> POLYGON((8.5 63.5, 8.5 64, 9 64, 9 63.5, 8.5 63.5))
> POLYGON((8.5 63.5, 8.5 64, 9 64, 9 63.5, 8.5 63.5))
> POLYGON((8.5 63.5, 8.5 64, 9 64, 9 63.5, 8.5 63.5))
> POLYGON((9 -2, 9 -1.5, 9.5 -1.5, 9.5 -2, 9 -2))
> POLYGON((9 -2, 9 -1.5, 9.5 -1.5, 9.5 -2, 9 -2))
> POLYGON((9 -2, 9 -1.5, 9.5 -1.5, 9.5 -2, 9 -2))
> POLYGON((9 -2, 9 -1.5, 9.5 -1.5, 9.5 -2, 9 -2))
> POLYGON((9 -2, 9 -1.5, 9.5 -1.5, 9.5 -2, 9 -2))
>
> *spatialite> select astext(geom) from my_table limit 14;*