Skip to content

Commit

Permalink
Change isinGeoRegion docs to in
Browse files Browse the repository at this point in the history
  • Loading branch information
natgeo-wong committed Jan 9, 2024
1 parent 2baad4e commit 7b47a0a
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/literate/using/isin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ And we see that this is indeed the case.
## API
```@docs
isinGeoRegion(
in(
Point :: Point2{<:Real},
geo :: RectRegion;
)
isinGeoRegion(::GeoRegion,::RectRegion)
isinGeoRegion(::GeoRegion,::PolyRegion)
in(::GeoRegion,::RectRegion)
in(::GeoRegion,::PolyRegion)
```
=#

Expand Down
72 changes: 68 additions & 4 deletions src/isin/isingeoregion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,79 @@ Other additional features include:
"""

## Is Point in GeoRegion?
"""
in(
Point :: Point2{<:Real},
geo :: GeoRegion;
tlon :: Real = 0,
tlat :: Real = 0,
throw :: Bool = true
) -> Bool
Check if a geographical point `point` is within a GeoRegion defined by `geo`.
"""
in(point::Point2{<:Real},geo::GeoRegion)
Base.in(
point :: Point2{<:Real},
geo :: GeoRegion;
tlon :: Real = 0,
tlat :: Real = 0,
throw :: Bool = true
) = isinGeoRegion(point,geo,tlon,tlat,throw)

"""
in(
Child :: GeoRegion,
polyG :: PolyRegion;
domask :: Bool = false,
throw :: Bool = true
) -> Bool
Check if a child GeoRegion defined by `Child` is within a PolyRegion `polyG`.
Arguments
=========
- `Child` : A GeoRegion that we postulate to be a "child", or a subset of the GeoRegion defined by `polyG`
- `polyG` : A GeoRegion that we postulate to be a "parent", or containing the GeoRegion defined by `Child`
Keyword Arguments
=================
- `throw` : If `true`, then if `Child` is not within `polyG`, an error is thrown and the program stops running
- `domask` : If `throw` is `false` and `domask` is `true`, return a mask (with bounds defined by the `Child` GeoRegion) showing the region where `Child` and `polyG` do not overlap
"""
Base.in(
Child :: GeoRegion,
polyG :: PolyRegion;
domask :: Bool = false,
throw :: Bool = true
) = isinGeoRegion(Child,polyG,domask,throw)

Check if a geographical point `point` is within a GeoRegion defined by `geo`.
"""
Base.in(point::Point2{<:Real},geo::GeoRegion) = isinGeoRegion(point,geo,throw=false)
in(
Child :: GeoRegion,
rectG :: RectRegion;
throw :: Bool = true
) -> Bool
Check if a child GeoRegion defined by `Child` is within a RectRegion `rectG`.
Arguments
=========
- `Child` : A GeoRegion that we postulate to be a "child", or a subset of the GeoRegion defined by `polyG`
- `polyG` : A GeoRegion that we postulate to be a "parent", or containing the GeoRegion defined by `Child`
Keyword Arguments
=================
- `throw` : If `true`, then if `Child` is not within `polyG`, an error is thrown and the program stops running
"""
Base.in(
Child :: GeoRegion,
rectG :: RectRegion;
throw :: Bool = true
) = isinGeoRegion(Child,rectG,throw)

"""
isinGeoRegion(
Expand Down

0 comments on commit 7b47a0a

Please sign in to comment.