Skip to content

[Feat] Add JSON to v.what.rast #6024

@petrasovaa

Description

@petrasovaa

Adding JSON to v.what.rast should look like:

v.what.rast map=bridges raster=elevation -p format=json
[
  { "category": 4635, "value": 86.85121 },
  { "category": 4648, "value": 87.88326 },
  { "category": 4688, "value": 103.382 },
  { "category": 4709, "value": 67.38786 },
  { "category": 4986, "value": 90.97283 },
  { "category": 4991, "value": 86.55063 },
  { "category": 5027, "value": 84.25636 },
  { "category": 5060, "value": 79.50044 },
  { "category": 5071, "value": 78.73286 },
  { "category": 5089, "value": 85.70364 },
  { "category": 5096, "value": 115.9673 },
  { "category": 5130, "value": 81.05587 },
  { "category": 5150, "value": 92.81293 },
  { "category": 5166, "value": 88.14948 },
  { "category": 5184, "value": 76.42633 }
]

I am little unsure if we are using "category" consistently across the tools.

Then there should be option format=csv and separator. By default, no format would be selected resulting in the current output. The header would be written into the CSV with format=csv, if no format is selected it will keep printing it with G_message for backwards compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgsocReserved for Google Summer of Code student(s)

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions