Skip to content

tools: add --link and --out parameters for raster and vector files#7182

Open
tangelll wants to merge 3 commits intoOSGeo:mainfrom
tangelll:subcommand_cli
Open

tools: add --link and --out parameters for raster and vector files#7182
tangelll wants to merge 3 commits intoOSGeo:mainfrom
tangelll:subcommand_cli

Conversation

@tangelll
Copy link

This pr open for this issue :#7176

Description: 

There is a project in Grass Gsoc ideas list which name is Subcommand CLI for GRASS. I am being able to finish Add --link-raster=some/file.tiff which links (r.external) a raster file (same for vector and similarly for r.external.out). 

How to do:

 I tested the raster linking functionality using the ortho2010_t792_subset_20cm.tif file from the nc_spm_08_grass7 dataset, ensuring the map name matched the filename. For vector testing, I used the ne_110m_admin_0_countries dataset from Natural Earth as an external sample to verify the link process.

https://www.naturalearthdata.com/downloads/110m-cultural-vectors/110m-admin-0-countries/  

To run my commands succesfuly you need to ensure that these files are in your workplaces.

Before Start

Before starting the test, ensure that you have copied your updated cli.py to the GRASS installation directory.

For me (macOS m4):

    cp cli.py /usr/local/grass85/etc/python/grass/app

To Test Image file 

python3 -m grass.app run r.info --link-raster=ortho2010_t792_subset_20cm.tif map=ortho2010_t792_subset_20cm.1

Result

| Type of Map: GDAL-link Number of Categories: 0 |
| Data Type: CELL Semantic label: (none) |
| Rows: 3750 |
| Columns: 3500 |
| Total Cells: 13125000 |
| Projection: x,y |
| N: 220750 S: 220000 Res: 0.2 |
| E: 639000 W: 638300 Res: 0.2 |
| Range of data: min = 0 max = 251 |
| |
| Data Source: |
| /Users/tangel/Works/grass/ortho2010_t792_subset_20cm.tif band 1 |
| |
| |
| Data Description: |
| generated by r.external |
| |
| Comments: |
| r.external -o input="ortho2010_t792_subset_20cm.tif" output="ortho20\ |
| 10_t792_subset_20cm"

To Test Map file

 python3 -m grass.app run v.info --link-vector=/ne_110m_admin_0_countries/ne_110m_admin_0_countries.shp map=ne_110m_admin_0_countries

 Result

OGR layer: ne_110m_admin_0_countries | 18:01 [260/653]
| OGR datasource: /Users/tangel/Downloads/ne_110m_admin_0_countries/ne_110m |

Feature type: polygon
Type of map: vector (level: 2)
Number of points: 0 Number of centroids: 288
Number of lines: 0 Number of boundaries: 289
Number of areas: 289 Number of islands: 289
Map is 3D: No
Number of dblinks: 1
Projection: x,y
N: 83.64513 S: -90
E: 180 W: -180
Digitization threshold: 0
Comment:

|

@github-actions github-actions bot added Python Related code is in Python libraries labels Mar 14, 2026
@tangelll tangelll changed the title add subcommand for --link-raster r.external: add subcommand for vector, raster file and r.external.out Mar 14, 2026
@tangelll tangelll changed the title r.external: add subcommand for vector, raster file and r.external.out cli: add --link and --out parameters for raster and vector files to 'run' tool Mar 14, 2026
@tangelll tangelll changed the title cli: add --link and --out parameters for raster and vector files to 'run' tool tools: add --link and --out parameters for raster and vector files Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries Python Related code is in Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant