[GRASS-user] Re: Change database type (Micha Silver)

Richard Chirgwin rchirgwin at ozemail.com.au
Thu Oct 21 17:34:50 EDT 2010


On 22/10/10 8:12 AM, grass-user-request at lists.osgeo.org wrote:
> Send grass-user mailing list submissions to
> 	grass-user at lists.osgeo.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://lists.osgeo.org/mailman/listinfo/grass-user
> or, via email, send a message with subject or body 'help' to
> 	grass-user-request at lists.osgeo.org
>
> You can reach the person managing the list at
> 	grass-user-owner at lists.osgeo.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of grass-user digest..."
>
>
> Today's Topics:
>
>     1. Change database type (Pablo Carreira)
>     2. v.in.ogr and g.region trouble coordenate (Ricardo Rodr?guez)
>     3. Re: Change database type (Micha Silver)
>     4. Re: v.in.ogr and g.region trouble coordenate (Micha Silver)
>     5. nviz_cmd problem winGrass6.5 - 7.0 (M.Onur Kurum)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 21 Oct 2010 15:23:15 -0200
> From: Pablo Carreira<pablotcarreira at hotmail.com>
> Subject: [GRASS-user] Change database type
> To:<grass-user at lists.osgeo.org>
> Message-ID:<SNT114-W15AB33CF89A9A96DFBD9B5D65D0 at phx.gbl>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
> Hi,
>
> I have many vectors with tables and now I want to change my database from sqlite to pgsql.I ran db.connect. And now I need to copy all the tables from sqlite to pgsql.Is there an easy way to do that?
> Thanks.
> Pablo Torres Carreira
>
>
>   		 	   		
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20101021/4ad2cda2/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Thu, 21 Oct 2010 15:19:17 -0500
> From: Ricardo Rodr?guez<ricardorodot02 at gmail.com>
> Subject: [GRASS-user] v.in.ogr and g.region trouble coordenate
> To: grass-user at lists.osgeo.org
> Message-ID:
> 	<AANLkTi=sUMPrB-4VxP=S8xjfT=Oj1PGzuaHe03EXgCfG at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> hello.
>   how to make g.region and v.in.ogr use the same projection that an incoming
> file. since at run-d g.region v.in.ogr and maintaining the coordinates but
> not the coordinate system, given the same coordinate system of the lease,
> what should I do to keep your incoming file coordinate system .
>
>
> thanks for your help and attention
>
> Ricardo Rodríguez
> Univalle
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20101021/3ae60005/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Thu, 21 Oct 2010 22:38:01 +0200
> From: Micha Silver<micha at arava.co.il>
> Subject: Re: [GRASS-user] Change database type
> To: Pablo Carreira<pablotcarreira at hotmail.com>
> Cc: grass-user at lists.osgeo.org
> Message-ID:<4CC0A4A9.2 at arava.co.il>
> Content-Type: text/plain; charset="iso-8859-1"
>
> On 10/21/2010 07:23 PM, Pablo Carreira wrote:
>> Hi,
>>
>>
>> I have many vectors with tables and now I want to change my database
>> from sqlite to pgsql.
>> I ran db.connect. And now I need to copy all the tables from sqlite to
>> pgsql.
>> Is there an easy way to do that?
>>
> Once you've set the database connection params, then g.copy will create
> a new vector with the attributes pushed into the new database. So you
> could loop thru all vectors something like:
> for v in `g.mlist vect`; do
>       g.rename vect=$v,$v_sqlite  # rename to temporary name
>        g.copy vect=$v_sqlite,$v        # copy back to original name, but
> pgsql tables will be created
> done
>
> If everything looks good, then you can remove all the vectors *_sqlite:
> g.remove vect=`g.mlist vect sep=, pat="*_sqlite"`
>
>> Thanks.
>>
>> Pablo Torres Carreira
>>
>>
>>
>> This mail was received via Mail-SeCure System.
>>
>>
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>
>> This mail was received via Mail-SeCure System.
>>
>>
>>
Alternatively, if you want to keep the two separate, create a new 
mapset, set the database connection in the new mapset, and copy the maps 
from old mapset to new.

Hence, in the new mapset:

for i in `g.list vect mapset=<oldmapset>`; do
g.copy vect=$i"@<oldmapset",$i
done

Often if I am going to be working away from the MySQL server, I do this 
to create a copy with a dbf connection.

Cheers,
Richard
>




More information about the grass-user mailing list