[GRASS-user] Export To PostGIS (with attributes)

gridcell dustin.sampson at timberline.ca
Wed Sep 10 10:25:51 EDT 2008


What I have been currently doing is...
1) v.in.ogr (import only geometry column from postgresql/postgis)
2) v.clean
3) v.out.ogr (layer 2)
4) In postgresql I run a point in polygon (PIP) on the table created in step
3)
5) Use the ST_Contains function with the original ("dirty") table to create
another table of attributes, which includes the unique id from the spatial
table.

My result in the case of two polygons that partially overlap...

Spatial Table                            Attribute Table

gid   wkb_geometry              sp_id   gid   parcel_name ....
1       XXXXXX                       1       1       Tom's Parcel          
2       XXXXXX                       2       2       Jane's Parcel
3       XXXXXX                       2       3       Tom's Parcel
                                          3       4        Jane's Parcel

I was hoping that all the processing could have been done in GRASS rather.




Moritz Lennert-2 wrote:
> 
> On 10/09/08 05:09, gridcell wrote:
>> Hi,
>> 
>>   I was wondering if there is a way to perform the following:
>> 
>> 1) Import a table from PostGIS (geometry and attributes)
> 
> v.in.ogr
> 
>> 2) Clean the geometry (example: overlapping polygons)
> 
> v.clean
> 
>> 3) Export the geometry back to PostGIS (topology layer, no overlaps) 
> 
> v.out.ogr
> 
>> 4) Export attributes back to PostgreSQL (potentially more than one row
>> linking to a single geometry, i.e. because of the overlaps)
> 
> v.out.ogr already exports attributes, but if you ever only need to move 
> around tables, you have db.copy / db.in.ogr / db.out.ogr.
> 
> Moritz
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 
> 

-- 
View this message in context: http://www.nabble.com/Export-To-PostGIS-%28with-attributes%29-tp19405378p19414583.html
Sent from the Grass - Users mailing list archive at Nabble.com.



More information about the grass-user mailing list