Skip to content

v.what.rast: Add JSON support #6140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NishantBansal2003
Copy link
Contributor

Fixes: #6024

This PR adds JSON support to the v.what.rast module. The JSON output looks like:

[
	{
		"category": 21,
		"value": 0.5
	},
	{
		"category": 22,
		"value": 1
	},
	{
		"category": 23,
		"value": 1.5
	},
	{
		"category": 24,
		"value": 2
	},
	{
		"category": 25,
		"value": 4.5
	}
]

This PR includes the following changes:

  1. Adds a format option with plain, csv, and json modes for output formatting.
  2. Adds separator option for CSV style output.
  3. Adds tests covering each of the new formats.
  4. Adds a Pandas example to the documentation for parsing JSON output.

Signed-off-by: Nishant Bansal <[email protected]>
@github-actions github-actions bot added vector Related to vector data processing Python Related code is in Python C Related code is in C module docs markdown Related to markdown, markdown files tests Related to Test Suite CMake labels Jul 29, 2025
@petrasovaa petrasovaa moved this to In Progress in GRASS JSON Outputs Aug 5, 2025
print(df)
```

Possible output:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also include the json output for completeness

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C CMake docs markdown Related to markdown, markdown files module Python Related code is in Python tests Related to Test Suite vector Related to vector data processing
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

[Feat] Add JSON to v.what.rast
2 participants