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" t

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 t

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 Gebaeude_Globalst

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 now.

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 input=Buildings@PE

Re: [GRASS-user] Joining vectors by location

2011-11-26 Thread Micha Silver
On 26/11/2011 21:40, Daniel Lee wrote: Alright, I think the last suggestion got me a LOT further. 2011/11/26 Micha Silver My guess: Wasn't your Gebaeude_Globalstrahlung table also a GRAS

Re: [GRASS-user] Joining vectors by location

2011-11-26 Thread Daniel Lee
And one last spam... Looking through the table I'm finding a lot of duplicate entries. cat 3491 is there about 5 times, cat 5990 several hundred. Any clue why? Is this really bad if I export it? ___ grass-user mailing list grass-user@lists.osgeo.org http:

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, bu

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 > 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 in the joined t

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
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 st

Re: [GRASS-user] Joining vectors by location

2011-11-26 Thread Daniel Lee
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. Their names are lower case versions of the names of the maps they're attached to in GRASS. They

Re: [GRASS-user] Joining vectors by location

2011-11-26 Thread Daniel Lee
2011/11/24 Micha Silver > 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 geography type

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-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 i

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-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 col

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 do

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 polygon

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 poly

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 v.sel

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 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 to be so nooby, but here's w

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 from GRASS-Addons SVN (be patient)... ... for g.extension please try the new 6.4.2rc2 built from source code, and the ver

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 points

Re: [GRASS-user] Joining vectors by location

2011-11-21 Thread Daniel Lee
2011/11/21 daniel mcinerney > 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):~ > g.extension extension=r.univar.

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] http://grass

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 a

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] http://grass.osgeo.org/gdp/html_grass64/v.rast.st

[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 done