From 2a7ddb162f53ef432eee3b8897fb64be52adaa7d Mon Sep 17 00:00:00 2001 From: Nathanael Wong Date: Tue, 1 Oct 2024 02:14:10 -0400 Subject: [PATCH] Adding API and updates to custom files documentation --- docs/src/api/project.md | 5 ++--- docs/src/tutorials/projects/files.md | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/docs/src/api/project.md b/docs/src/api/project.md index f9266ff0..3b227907 100644 --- a/docs/src/api/project.md +++ b/docs/src/api/project.md @@ -3,10 +3,9 @@ ```@docs setupGeoRegions deleteGeoRegions -``` - -```@docs tableGeoRegions( fname :: AbstractString ) +readGeoRegions +addGeoRegions ``` \ No newline at end of file diff --git a/docs/src/tutorials/projects/files.md b/docs/src/tutorials/projects/files.md index 9da53745..3d85de06 100644 --- a/docs/src/tutorials/projects/files.md +++ b/docs/src/tutorials/projects/files.md @@ -2,6 +2,11 @@ This page gives a brief introduction into how to **manually** defined custom `GeoRegion`s in their respective files. +```@example files +using GeoRegions +using DelimitedFiles +``` + ## `RectRegion` and `TiltRegion` Files Manually defining a `RectRegion` or a `TiltRegion` in the `rectlist.txt` and `tiltlist.txt` files is relatively simple. Simple follow the order of the headers in the respective files. @@ -101,6 +106,22 @@ PolyRegion( ) ``` +!!! warning "Additional empty lines" + There is an empty line between each `PolyRegion` being defined. And **there needs to be an additional empty line after the last `PolyRegion` defined. Please see `joinpath($(GeoRegions.geodir),"ar6.txt")` as an example. + ## Listing GeoRegions inside Custom Files -It is possible to list the GeoRegions in specified file. The template for these files can be retrieved using the function `setupGeoRegions()` \ No newline at end of file +Suppose you have a list of `GeoRegion`s inside a custom file (that is not `rectlist.txt`, `tiltlist.txt` or `polylist.txt`), you can read the `GeoRegion`s defined inside this custom file into your project via `readGeoRegions()` + +```@example files +download("https://raw.githubusercontent.com/natgeo-wong/GeoRegionsEcosystem/main/files/customrect.txt","test.geo") +geovec = readGeoRegions("test.geo") +``` + +## Adding GeoRegions inside Custom Files + +We can directly add the `GeoRegion`s inside such custom files using the function `addGeoRegions()` as follows: + +```@example files +addGeoRegions("test.geo",path=pwd()) +``` \ No newline at end of file