Code Monkey home page Code Monkey logo

Comments (3)

petrasovaa avatar petrasovaa commented on June 11, 2024

See #3020 for tracking modules that need JSON/YAML output.

from grass.

HuidaeCho avatar HuidaeCho commented on June 11, 2024

Random ideas

  • Adding a new standard option (e.g., G_OPT_M_FORMAT)
  • Implementing a new library function for format translations (e.g., G_translate_format())
  • Maybe, some more utility functions to generate JSON objects (would this format be the most complex and expressible format for GRASS?)
  • Individual modules only generate JSON outputs (the superset of all formats) and use G_translate_format() to produce other formats

from grass.

wenzeslaus avatar wenzeslaus commented on June 11, 2024

A lot of tools need key value format, so some universal translating function would work. Another group might be table data. Some tools would have to keep their own formats at least if we want to stay compatible. The human readable output is also important. YAML can sometimes count like that.

What is funny is that GRASS GIS is using basically YAML files since 80s to store things internally. Internal WIND file looks like this:

proj:       99
zone:       0
north:      221230
south:      219580
east:       639530
west:       637740
cols:       179
rows:       165
e-w resol:  10
n-s resol:  10
top:        1
bottom:     0
cols3:      179
rows3:      165
depths:     1
e-w resol3: 10
n-s resol3: 10
t-b resol:  1

But for machine readable output, it gets translated to:

projection=99
zone=0
n=221230
s=219580
w=637740
e=639530
nsres=10
ewres=10
rows=165
cols=179
cells=29535

which was designed for Bash eval and similar usage, but these days most people would likely choose JSON or YAML as sort of the default machine readable format for this data. Same for raster cellhd and vector head files and what r.info and v.info produce.

  __________________
/    GRASS GIS       \
\        is yamly!   /
  -------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
_\|/__\|/__\|/_ ||     ||  _\|/__\|/_

from grass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.