Re: [GRASS-user] How to use g.extension in GRASS7.8
On 1/10/23 1:44 AM, Bernardo Santos via grass-user wrote: I unfortunately do not have a way to upgrade it myself since this is a company server shared with other people (and we have been fighting with IT to change to GRASS 8). But maybe it is easier to at lease update GRASS to version 7.8.7 (or 7.8.8). A workaround, without having to upgrade GRASS (which is not a good idea), is to clone the grass-addons repo and supply a local path as extension URL. git clone -b grass7 https://github.com/OSGeo/grass-addons $PWD/grass-addons g.extension extension=r.area url=$PWD/grass-addons/src/raster/r.area Asim ___ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Export raster to PostGIS
Hi Māris Thank you for pointing out the read-only limitation of GDAL library. A natural workaround is to convert the raster to vector with r.to.vect and then use v.out.postgis. However, there are some hurdles with regards to the type of resulting geometries (boundary, centroid and area) arising after the conversion to vector. I will start a separate thread if I can articulate the problem somewhat precisely. Asim ___ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Export raster to PostGIS
Hello Is it possible to export a raster map created using r.water.outlet to PostGIS in GRASS 78? The documentation indicates using r.out.gdal with PostGISRaster as format. The command I'm trying is the following: r.out.gdal input=mywatershed format=PostGISRaster output=mywatershed createopt="PG:dbname='mydb'" The postgresql server is running with locally and the database "mydb" can be accessed without having to enter a password using psql client. However, this command fails with the error: ERROR 6: PostGISRasterDataset::CreateCopy() only works on source datasets that are PostGISRaster Is something wrong in the command? The error message seems to suggest that it is impossible to export the raster map created with r.water.outlet to PostGIS because it is not sourced from PostGIS. Can someone please confirm? Asim ___ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Creating a new vector map with pygrass
Hello! Here is yet another request for hand-holding with GRASS GIS. This time it's aquestion on pygrass API, version 7.8.5. I want to create a new vector map from a Python script. The steps I'm following are: 1. Create a VectorTopo object with. 2. Define attribute columns: cols = [(column name, type), ...] 3. Open the VectorTopo object in write mode: write("w", tab_cols=cols, ...). 4. Add geometry objects, in my case it's Area objects, one by one using write() interface. 5. Commit changes and close the VectorTopo. Step 4, however, is causing "AttributeError" in a pygrass module. Stack trace: Traceback (most recent call last): File "stream_features.py", line 404, in generateWatersheds(ssegs, dwsmapname) File "stream_features.py", line 359, in generateWatersheds dwsvector.write( File "/Applications/GRASS-7.8.app/Contents/Resources/etc/python/grass/pygrass/errors.py", line 15, in wrapper return method(self, *args, **kargs) File "/Applications/GRASS-7.8.app/Contents/Resources/etc/python/grass/pygrass/vector/__init__.py", line 217, in write result = self._write_area(geo_obj) AttributeError: 'VectorTopo' object has no attribute '_write_area' Can someone shed light on where my understanding is going wrong? Is this a bug in vector/__init__.py? The code snippet for reference: dwsvector = vector.VectorTopo("differential_watersheds") dwscols = [("cat", "INTEGER PRIMARY KEY"), ("stream1", "INTEGER"), ("stream2", "INTEGER")] dwsvector.open("w", tab_name=dwsmapname, tab_cols=dwscols, overwrite=True) cat = 1 # "boundary" is a vector.geometry.Boundary object, obtained # from an existing vector map that is opened previously. areageom = vector.geometry.Area(v_id=boundary.id, c_mapinfo=boundary.c_mapinfo) dwsvector.write( areageom, cat, attrs=(boundary.attrs["s1"], boundary.attrs["s2"])) # The AttributeError thrown when the write() method above is invoked. Hope the problem description is clear, if it isn't, please let me know. Asim ___ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Clip a raster using a polygon boundary with r.mask
Hi Micha Thank you for the detailed steps. I tried both the versions and they worked. The r.info output showed less number of rows and columns when the "small_vector" was chosen as the region. Things are much clearer now, thanks again! Asim ___ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Clip a raster using a polygon boundary with r.mask
Hello! I've recently started using GRASS and finding it very cool. The only other GIS software I'm familiar with is QGIS. Today's newbie question is how to clip a raster using a vector having polygon geometries? Judging by the docs, r.mask should be used with "vector=..." parameter. The command "r.mask raster=big_raster vector=smaller_vector" was successful, mask was created. However, when "big_raster" was added to the map layers in GUI, it was rendered in its entirety, without getting clipped. An operation such as r.to.vect on big_raster also resulted in the entire raster being used. What am I missing? Are there examples illustrating the use of "vector=" parameter in r.mask? Asim ___ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user