[GRASS-user] Join sqlite table by coordinate pair (X,Y)
Richard Chirgwin
rchirgwin at ozemail.com.au
Mon Oct 22 14:59:20 PDT 2012
On 23/10/12 6:00 AM, grass-user-request at lists.osgeo.org wrote:
> Message: 1
> Date: Mon, 22 Oct 2012 13:20:02 +0200
> From: Johannes Radinger<johannesradinger at gmail.com>
> To:grass-user at lists.osgeo.org
> Subject: [GRASS-user] Join sqlite table by coordinate pair (X,Y)
> Message-ID:
> <CABsGe_xs1NHvOhGX_vvW=fe_afVf-ptkzB2kESa1xUOcw5GJOg at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi,
>
> I have a points vector file with the columns X and Y which are
> populated with the respective coordinates.
> Additionally I have a .csv file for the same points, also with the X
> and Y column and a lot more columns
> providing additional information. These two files don't share a single
> unique key which can be used for joining.
>
> Thus I'd like to use the X-Y pair as a key for importing and then
> joining the csv table
> to the vector. Is there any possibility to use two columns as a
> combined key instead of one
> (probably an SQL statement for db.execute)? Or do I need to first
> create a new column
> and combine x and y into a key for the vector and the csv?
>
> Any suggestions how that can be done in GRASS (6.5, sqlite) in a simple way?
>
> Best regards,
> Johannes
My suggestion -
Map_a = your sqlite map
Map_b = the csv file
1. Import the csv file as Map_b
2. Add a column to Map_b to capture the categories in Map_A (a_cat)
3. Use v.distance to populate the "a_cat" column in Map_b
4. v.db.connect Map_a table=Map_b key=a_cat layer=2
Step 4 means that the second table is now connected to your original
map, using the same category values as the key.
cheers,
Richard
More information about the grass-user
mailing list