Re: [GRASS-user] Joining vectors by location

2011-11-28 Thread Daniel Lee
Hi Richard, What do you get if you run db.connect -p in the relevant mapset? Here's my output: GRASS 6.4.2RC2 (EPSG:3857 - Pseudo-Mercator):~ db.connect -p driver:pg database:host=localhost,dbname=isis_db_extern schema: group: Seems to be okay, right? In any case, the last spatial join try

Re: [GRASS-user] Joining vectors by location

2011-11-27 Thread Daniel Lee
Okay, first of all, thanks once again for all the patience and the huge amount of help. I'm now quite a bit further and just wanted to report back on how it all worked out so that people in similar quandries will be able to deal :) It doesn't work all the way yet, but at least I'm a lot closer

Re: [GRASS-user] Joining vectors by location

2011-11-27 Thread Daniel Lee
SUCCESS! One last idea came: Why not try updating the attributes backwards - uploading the attributes of the centroids from the former raster polygons into the buildings that they belonged to? The following command updated the vectors properly by extracting the centroid values of

Re: [GRASS-user] Joining vectors by location

2011-11-27 Thread Richard Chirgwin
On 27/11/11 5:30 AM, Daniel Lee wrote: Just another thing that's really weird - I ended up exporting the geometries from GRASS to shapefiles, importing them to PostGIS with shp2pgsql and viewing them in QGIS from the DB directly, just to see if that would work. It did, just fine. Then I tried

Re: [GRASS-user] Joining vectors by location

2011-11-26 Thread Daniel Lee
2011/11/24 Micha Silver mi...@arava.co.il There are two separate metadata tables in newer PostGIS versions. The original geometry_columns is a real table as listed above. In addition there is support for the geography data type for layers in geographic (Lat/Lon) coordinate systems. With the

Re: [GRASS-user] Joining vectors by location

2011-11-26 Thread Daniel Lee
Just another thing that's really weird - I ended up exporting the geometries from GRASS to shapefiles, importing them to PostGIS with shp2pgsql and viewing them in QGIS from the DB directly, just to see if that would work. It did, just fine. Then I tried to view them with the Geoserver again and

Re: [GRASS-user] Joining vectors by location

2011-11-26 Thread Micha Silver
On 11/26/2011 05:10 PM, Daniel Lee wrote: Alright, I just tried it again and, again, no dice, although at least my thematic tables are stored in the PostGIS DB. Here's what's going on: - I am the owner of the tables that are created in PostGIS.

Re: [GRASS-user] Joining vectors by location

2011-11-26 Thread Daniel Lee
Alright, I think the last suggestion got me a LOT further. 2011/11/26 Micha Silver mi...@arava.co.il My guess: Wasn't your Gebaeude_Globalstrahlung table also a GRASS vector? So it also has a cat column? What v.db.join does is try to create a new column in the map's table for *each* column

Re: [GRASS-user] Joining vectors by location

2011-11-26 Thread Daniel Lee
Okay, sorry to bug again, but now I do have kind of the same problem again. Here we go: v.out.ogr only gives me the field cat in the attribute table, all other fields are gone: v.out.ogr input=Buildings@PERMANENT type=area dsn=/tmp/buildings.shp layer=2 --overwrite The geometries are exported,

Re: [GRASS-user] Joining vectors by location

2011-11-26 Thread Micha Silver
On 26/11/2011 22:09, Daniel Lee wrote: Okay, sorry to bug again, but now I do have kind of the same problem again. Here we go: v.out.ogr only gives me the field cat in the attribute table, all other fields are gone: v.out.ogr

Re: [GRASS-user] Joining vectors by location

2011-11-25 Thread Moritz Lennert
On 24/11/11 17:18, Daniel Lee wrote: IIRC, geography_columns is a view, not sure why you would even want to access that... I don't have time right now to try to find out where the error message comes from. Can you give us the exact v.in.ogr command you use ? Gotcha. I think it

Re: [GRASS-user] Joining vectors by location

2011-11-25 Thread Pankaj Kr Sharma
Dear Daniel, Try to find the owner of your geography tables. Most probably, it will be postgres. So, login as postgres and from their grant all on geography tables to the desired owner. You may copy , paste and search this phrase how to find owner of a postgis table

Re: [GRASS-user] Joining vectors by location

2011-11-24 Thread Daniel Lee
You can use v.distance with dmax=0 to do such a spatial join between polygons and points: v.db.addcolumn YourCentroids col='poly_cat int' v.distance from=YourCentroids to=YourPolygons upload=cat column=poly_cat dmax=0 This should upload the category values of your polygons to the

Re: [GRASS-user] Joining vectors by location

2011-11-24 Thread Moritz Lennert
On 24/11/11 09:47, Daniel Lee wrote: I'm currently trying to upload the data into my PostGIS DB to do the next step, but I'm having some trouble there - I get the following error when using v.out.ogr: ERROR 1: ERROR: permission denied for relation geography_columns ERROR 1: PostgreSQL driver

Re: [GRASS-user] Joining vectors by location

2011-11-24 Thread Micha Silver
On 24/11/2011 10:47, Daniel Lee wrote: You can use v.distance with dmax=0 to do such a "spatial join" between polygons and points: v.db.addcolumn YourCentroids

Re: [GRASS-user] Joining vectors by location

2011-11-24 Thread Daniel Lee
IIRC, geography_columns is a view, not sure why you would even want to access that... I don't have time right now to try to find out where the error message comes from. Can you give us the exact v.in.ogr command you use ? Gotcha. I think it is a table, actually: test=# \dt

Re: [GRASS-user] Joining vectors by location

2011-11-22 Thread Daniel Lee
Hi there, You can use v.distance with dmax=0 to do such a spatial join between polygons and points: v.db.addcolumn YourCentroids col='poly_cat int' v.distance from=YourCentroids to=YourPolygons upload=cat column=poly_cat dmax=0 This should upload the category values of your polygons to

[GRASS-user] Joining vectors by location

2011-11-21 Thread Daniel Lee
Hi group, Does anyone have a good idea of how to join vector areas by location? I'm trying to do aggregated statistics on vector maps using extracted values from rasters. I want the sum of the raster cells that lie within the vectors to be inserted into the vector attribute table. So far I've

Re: [GRASS-user] Joining vectors by location

2011-11-21 Thread daniel mcinerney
Hi Daniel. You should use v.rast.stats [1] as it Calculates univariate statistics from a raster map based on vector polygons and uploads statistics to new attribute columns. Should be a more straight forward approach. Best Regards, Daniel. [1]

Re: [GRASS-user] Joining vectors by location

2011-11-21 Thread Daniel Lee
Hi Daniel, Very cool name :) You should use v.rast.stats [1] as it Calculates univariate statistics from a raster map based on vector polygons and uploads statistics to new attribute columns. Should be a more straight forward approach. Thanks for the tip, but v.rast.stats gives me all

Re: [GRASS-user] Joining vectors by location

2011-11-21 Thread daniel mcinerney
Hi Daniel, According to the documentation of [1] and previous discussions [2], v.rast.stats2 should be a lot faster. You should be able to change the BASECOLS variable in the script to only output the sums, which might speed things up for you. Hope that helps. Regards, Daniel. [1]

Re: [GRASS-user] Joining vectors by location

2011-11-21 Thread Daniel Lee
2011/11/21 daniel mcinerney daniel.o.mciner...@gmail.com According to the documentation of [1] and previous discussions [2], v.rast.stats2 should be a lot faster. Awesome! Only... I've got a problem here... Sorry to be so nooby, but here's what's going on: GRASS 6.4.2RC1 (ETRS89_ll):~

Re: [GRASS-user] Joining vectors by location

2011-11-21 Thread Daniel Lee
Alright, I just figured out a way to do it, albeit an unelegant way that requires using another program. I converted the rasters to vectors as usual. Then I did the following in order to preserve the original polygons: - Extracted the centroids by using v.select - Converted the centroids to

Re: [GRASS-user] Joining vectors by location

2011-11-21 Thread Hamish
Daniel Lee wrote: GRASS 6.4.2RC1 (ETRS89_ll):~ g.extension extension=r.univar.zonal WARNING: GRASS_ADDON_PATH is not defined, installing to ~/.grass6/addons/ Fetching r.univar.zonal from GRASS-Addons SVN (be patient)... ... for g.extension please try the new 6.4.2rc2 built from source code,

Re: [GRASS-user] Joining vectors by location

2011-11-21 Thread Moritz Lennert
On 21/11/11 18:00, Daniel Lee wrote: 2011/11/21 daniel mcinerney daniel.o.mciner...@gmail.com mailto:daniel.o.mciner...@gmail.com According to the documentation of [1] and previous discussions [2], v.rast.stats2 should be a lot faster. Awesome! Only... I've got a problem here... Sorry

Re: [GRASS-user] Joining vectors by location

2011-11-21 Thread Moritz Lennert
On 21/11/11 19:24, Daniel Lee wrote: Alright, I just figured out a way to do it, albeit an unelegant way that requires using another program. I converted the rasters to vectors as usual. Then I did the following in order to preserve the original polygons: - Extracted the centroids by using