v.to.db: add JSON support
Add JSON output support to v.to.db module. The output looks like as follows:
{
"totals": {
"area": 2219442027.2203522
},
"records": [
{
"category": 1,
"area": 24375323.127803534
},
{
"category": 2,
"area": 2938964.3204806102
},
{
"category": 3,
"area": 50536154.294107705
}
],
...
}
@cwhite911 Hi! Can you please review this PR? I would like to use the JSON format added here in the v.report module's JSON implementation to keep the implementation simple.
@cwhite911 Hi! Can you please review this PR? I would like to use the JSON format added here in the v.report module's JSON implementation to keep the implementation simple.
@kritibirda26 the schema looks good to me, however I'm debating if we should add the measurement unit to the root object.
If it's documented for now, it won't be breaking to add it at a later time if needed. So if you can't decide after thinking about it for a while, there's a way to keep the PR going.
@cwhite911 can you please take another look at this PR?
@kritibirda26 Please add additional unit tests to capture the all of the response data types (point, line, polygon, 3d vectors, mixed with the options: cat, area, compact, fd, perimeter, length, count, coor, start, end, sides, query, slope, sinuous, azimuth, bbox.
Let's also add the measurement unit to the root json object.
@cwhite911 Should there be at least one test covering each type and each option? asking because it doesn't seem possible to provide multiple options or types to v.to.db at once.
@cwhite911 Should there be at least one test covering each type and each option? asking because it doesn't seem possible to provide multiple options or types to
v.to.dbat once.
Yes, we should add a test to make sure each key value pair is correctly generated for the option.
@cwhite911 I have added more tests and measurement units to the root of the object. Can you please suggest which maps/commands to use to test query, azimuth, sinuousity and slope?
@cwhite911, Hi! I have updated the PR with tests for azimuth and sinuous. For slope, I tried to create a 3d map but failed. I also followed other examples of creating a 3d dataset from 2d (from the tests of other modules) but the slope always comes to be 0 in both plain and json mode.
Missing to adjust cmakefiles to add json in v.to.db