Skip to content
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

docs: mkdocs index and nav redesign #5207

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions man/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ DSTFILES := \
$(MDDIR)/source/favicon.ico \
$(MDDIR)/source/grassdocs.css \
$(MDDIR)/scripts/hook_list_scripts.py \
$(MDDIR)/source/index.md \
$(MDDIR)/overrides/partials/footer.html \
$(MDDIR)/overrides/partials/actions.html \
$(MDDIR)/source/tags.md
Expand Down Expand Up @@ -159,10 +160,6 @@ $(HTMLDIR)/index.html: build_index.py build_html.py
$(call build,index)
touch $@

$(MDDIR)/source/index.md: build_index.py build_md.py
$(call build,index)
touch $@

$(HTMLDIR)/keywords.html: $(ALL_HTML)
$(call build_keywords)
touch $@
Expand Down Expand Up @@ -247,6 +244,9 @@ $(HTMLDIR)/parser_standard_options.css: parser_standard_options.css
$(MDDIR)/mkdocs.yml: mkdocs/mkdocs.yml
$(INSTALL_DATA) $< $@

$(MDDIR)/source/index.md: mkdocs/index.md
$(INSTALL_DATA) $< $@

$(MDDIR)/source/grass_logo.svg: grass_logo.svg
$(INSTALL_DATA) $< $@

Expand Down
15 changes: 7 additions & 8 deletions man/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,15 @@ def write_header(f, title, ismain=False, body_width="99%", template="html"):


def write_cmd_overview(f, template="html"):
from build_html import overview_tmpl

if template == "html":
from build_html import overview_tmpl
else:
from build_md import overview_tmpl
f.write(
overview_tmpl.substitute(
grass_version_major=grass_version_major,
grass_version_minor=grass_version_minor,
f.write(
overview_tmpl.substitute(
grass_version_major=grass_version_major,
grass_version_minor=grass_version_minor,
)
)
)


def write_footer(f, index_url, year=None, template="html"):
Expand Down
2 changes: 0 additions & 2 deletions man/build_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,3 @@ def build_index(ext):

if __name__ == "__main__":
build_index("html")

build_index("md")
122 changes: 0 additions & 122 deletions man/build_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,128 +39,6 @@
"""
)

# TODO: avoid HTML tags
overview_tmpl = string.Template(
r"""<!-- the files grass${grass_version_major}.html & helptext.html file live in lib/init/ -->

<table align="center" border="0" cellspacing="8">
<tbody>
<tr>
<td width="33%" valign="top" class="box"><h3>&nbsp;Quick Introduction</h3>
<ul>
<li class="box"><a href="helptext.html">How to start with GRASS GIS</a></li>
<li class="box"><span>Index of <a href="topics.html">topics</a> and <a href="keywords.html">keywords</a></span></li>
</ul>
<p>
<ul>
<li class="box"><a href="projectionintro.html">Intro: projections and spatial transformations</a></li>
</ul>
<p>
<ul>
<li class="box"><span><a href="https://grasswiki.osgeo.org/wiki/Faq">FAQ - Frequently Asked Questions</a> (Wiki)</span></li>
</ul>
<p>
<ul>
<li class="box"><span><a href="graphical_index.html">Graphical index of functionality</a></span></li>
</ul>
</td>
<td width="33%" valign="top" class="box"><h3>&nbsp;Graphical User Interface</h3>
<ul>
<li class="box"><a href="wxguiintro.html">Intro: Graphical User Interface</a></li>
<li class="box"><span><a href="wxGUI.html">wxGUI</a></span></li>
<li class="box"><a href="wxGUI.components.html">wxGUI components</a></li>
<li class="box"><a href="wxGUI.toolboxes.html">wxGUI toolboxes</a></li>
</ul>

<ul>
<li class="box"><a href="topic_GUI.html">GUI commands</a></li>
</ul>
<h3>&nbsp;Display</h3>
<ul>
<li class="box"><a href="display.html">Display commands manual</a></li>
<li class="box"><a href="displaydrivers.html">Display drivers</a></li>
</ul>
</td>
<td width="33%" valign="top" class="box"><h3>&nbsp;General</h3>
<ul>
<li class="box"><a href="grass.html">GRASS GIS startup manual</a></li>
<li class="box"><a href="general.html">General commands manual</a></li>
</ul>
<h3>&nbsp;Addons</h3>
<ul>
<li class="box"><a href="https://grass.osgeo.org/grass8/manuals/addons/">Addons manual pages</a></li>
</ul>
<h3>&nbsp;Programmer's Manual</h3>
<ul>
<li class="box"><a href="https://grass.osgeo.org/programming8/">Programmer's Manual</a></li>
</ul>
</td>
</tr>
<tr>
<td width="33%" valign="top" class="box"><h3>&nbsp;Raster processing</h3>
<ul>
<li class="box"><a href="rasterintro.html">Intro: 2D raster map processing</a></li>
<li class="box"><a href="raster.html">Raster commands manual</a></li>
</ul>
</td>
<td width="33%" valign="top" class="box"><h3>&nbsp;3D raster processing</h3>
<ul>
<li class="box"><a href="raster3dintro.html">Intro: 3D raster map (voxel) processing</a></li>
<li class="box"><a href="raster3d.html">3D raster (voxel) commands manual</a></li>
</ul></td>
<td width="33%" valign="top" class="box"><h3>&nbsp;Image processing</h3>
<ul>
<li class="box"><a href="imageryintro.html">Intro: image processing</a></li>
<li class="box"><a href="imagery.html">Imagery commands manual</a></li>
</ul></td>
</tr>
<tr>
<td width="33%" valign="top" class="box"><h3>&nbsp;Vector processing</h3>
<ul>
<li class="box"><a href="vectorintro.html">Intro: vector map processing and network analysis</a></li>
<li class="box"><a href="vector.html">Vector commands manual</a></li>
<li class="box"><a href="vectorascii.html">GRASS ASCII vector format specification</a></li>
</ul></td>
<td width="33%" valign="top" class="box"><h3>&nbsp;Database</h3>
<ul>
<li class="box"><a href="databaseintro.html">Intro: database management</a></li>
<li class="box"><a href="sql.html">SQL support in GRASS GIS</a></li>
<li class="box"><a href="database.html">Database commands manual</a></li>
</ul>
</td>
<td width="33%" valign="top" class="box"><h3>&nbsp;Temporal processing</h3>
<ul>
<li class="box"><a href="temporalintro.html">Intro: temporal data processing</a></li>
<li class="box"><a href="temporal.html">Temporal commands manual</a></li>
</ul>
</td>
</tr>
<tr>
<td width="33%" valign="top" class="box"><h3>&nbsp;Cartography</h3>
<ul>
<li class="box"><a href="postscript.html">PostScript commands manual</a></li>
<li class="box"><a href="g.gui.psmap.html">wxGUI Cartographic Composer</a></li>
</ul>
</td>
<td width="33%" valign="top" class="box"><h3>&nbsp;Miscellaneous&nbsp;&amp;&nbsp;Variables</h3>
<ul>
<li class="box"><a href="miscellaneous.html">Miscellaneous commands manual</a></li>
<li class="box"><a href="variables.html">GRASS variables and environment variables</a></li>
</ul>
</td>
<td width="33%" valign="top" class="box"><h3>&nbsp;Python</h3>
<ul>
<li class="box"><a href="https://grass.osgeo.org/grass${grass_version_major}${grass_version_minor}/manuals/libpython/index.html">GRASS GIS Python library documentation</a></li>
<li class="box"><a href="https://grass.osgeo.org/grass${grass_version_major}${grass_version_minor}/manuals/libpython/pygrass_index.html">PyGRASS documentation</a></li>
<li class="box"><a href="https://grass.osgeo.org/grass${grass_version_major}${grass_version_minor}/manuals/libpython/grass.jupyter.html">GRASS GIS in Jupyter Notebooks</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
"""
)

# footer_tmpl = string.Template(
# r"""
# ____
Expand Down
8 changes: 8 additions & 0 deletions man/mkdocs/grassdocs.css
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,11 @@
.md-typeset table:not([class]) tbody tr:hover {
background-color: transparent;
}

.gs-icon-primary {
color: var(--gs-primary-color);
}

.gs-icon-accent {
color: var(--gs-secondary-color);
}
139 changes: 139 additions & 0 deletions man/mkdocs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
## What is GRASS?

[GRASS](https://grass.osgeo.org/) is a geosptial processing engine for
advance analysis and visualization of geospatial data. It is a powerful tool for
processing and analyzing geospatial data sets. GRASS is a free and open source
software, released under an open source [GNU GPLed](https://www.gnu.org/licenses/gpl.html).

Downloaded and installed GRASS here.

<!-- markdownlint-disable-next-line MD013 -->
[:material-download: Download and Install](https://grass.osgeo.org/download/){ .md-button }

## Tutorials

Get started with GRASS by following the
[tutorials](https://grass-tutorials.osgeo.org/) below.

## Interfaces

GRASS provides a number of interfaces for interacting with the software. The
most common interfaces are:

### [Terminal](grass.md)

The terminal interface allows you to start a GRASS session to run GRASS
commands, execute scripts, or open the GUI.

Here we creating a new project for the NAD83(HARN)/North Carolina coordinate
reference system (EPSG:3358) and start a GRASS session in the terminal.

```sh
grass -c EPSG:3358 {project directory} --text

```

The terminal can now execute GRASS commands.

```sh
g.region raster=elevation
r.slope.aspect elevation=elevation slope=slope aspect=aspect
```

To learn more about the terminal interface, see the
[Terminal Interface](grass.md) page.

### Python Scripts
Copy link
Member

Choose a reason for hiding this comment

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

C doc and possibly general tool writing stuff (standard parser options): I wonder if to put it here as sort of next steps ("is this not enough?") or at the end to a separate section. This would be the usage as a modeling platform.


The `grass.script` module provides a Python interface to GRASS. This allows
users to write Python scripts to interact with GRASS. The `grass.script` module
Comment on lines +46 to +49
Copy link
Member

Choose a reason for hiding this comment

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

We need to start describing the in-session version grass.script.setup.init.

contains the gs.script.core module which provides the core functionality for the
GRASS Python interface, the `grass.script.raster` module which provides
functionality for working with raster data, and the `grass.script.vector` module
which provides functionality for working with vector data.

To get started Python, create a new project and run the

```python
import sys
import subprocess

# Append GRASS to the python system path
sys.path.append(
subprocess.check_output(["grass", "--config", "python_path"], text=True).strip()
)

import grass.script as gs

# Create a new project
gs.create_project(path=grassdata, name=project_name, epsg="3358", overwrite=False)

# Run GRASS commands
gs.run_command('g.region', raster='elevation')
gs.run_command('r.slope.aspect', elevation='elevation', slope='slope', aspect='aspect')
```

### Jupyter Notebooks

Jupyter Notebooks are a great way to interact with GRASS. The `grass.jupyter`
module provides a Jupyter interface to GRASS. This allows users to write Jupyter
Notebooks to interact with GRASS. The `grass.jupyter` module contains the `Map`,
`InteractiveMap`, `Map3D`, `TimeSeriesMap`, and `SeriesMap` classes which
provide functionality for working with maps in Jupyter Notebooks.

```python
import grass.jupyter as gj

session = gj.init(Path(grassdata, project_name))

slope_map = gj.Map() # Create a new map
slope_map.d_rast(map='slope') # Add the slope raster to the map
slope_map.d_barscale(at=(80, 10)) # Add a bar scale to the map
slope_map.d_legend(raster='slope', at=(80, 90)) # Add a legend to the map
slope_map.show() # Display the map
```

![Slope Map](r_slope_aspect_slope.png)

### [GRASS Desktop GUI](wxguiintro.md)

Add content here.

## [Project Management](grass_database.md)

Add Content here.

## Processing Tools

GRASS provide a wide range of tools for geospatial processing, modeling,
analysis, and visualization. The tools are organized into categories based
on the type of data they process. The tools are prefixed with a letter to
indicate the type of data they process.

The following table provides a list of the prefixes and the categories they represent.
Follow the topics links to see a complete list of tools in each category. Or try
using the search feature to find a specific tool or topic by subject
matter (e.g. hydrology, landscapes).

### GRASS Tools

| Prefix | Category | Description | Topic |
|--------|----------------------------------|------------------------------------|-------------------------------------------|
| `g.` | General | General GIS management tools | [General Tools](general.md) |
| `r.` | Raster | Raster data processing tools | [Raster Tools](raster.md) |
| `r3.` | 3D Raster | 3D Raster data processing tools | [3D Raster Tools](raster3d.md) |
| `v.` | Vector | Vector data processing tools | [Vector Tools](vector.md) |
| `i.` | Imagery | Imagery processing tools | [Imagery Tools](imagery.md) |
| `t.` | Temporal | Temporal data processing tools | [Temporal Tools](temporal.md) |
| `db.` | Database | Database management tools | [Database Tools](database.md) |
| `d.` | Display | Display and visualization tools | [Display Tools](display.md) |
| `m.` | Miscellaneous | Miscellaneous tools | [Miscellaneous Tools](miscellaneous.md) |
| `ps.` | Postscript | Postscript tools | [Postscript Tools](postscript.md) |

### Addons

In addition to the core tools, GRASS also provides a number of addons that
extend the functionality of GRASS. Addons are part of the [OSGeo/grass-addons](https://github.com/OSGeo/grass-addons)
repository and are a great place to plubish and share custom tools, models, and reserach.
The addons are maintained by the GRASS community and are a great way to extend the
functionality of GRASS.
Loading
Loading