Skip to content

API for Is it in/on/equal to a GeoRegion?

In

Is Point In a GeoRegion

Base.in Method
julia
in(
    point :: Point2{<:Real},
    geo   :: GeoRegion;
    throw :: Bool = false,
    sigdigits :: Int = 10
) -> tf :: Bool

Check if a geographical point point is within a GeoRegion defined by geo.

Arguments

  • point : A geographical point of Type Point. Pass Point(plon,plat), where plon and plat are the longitude and latitudes of the point.

  • geo : The GeoRegion struct container.

Keyword Arguments

  • throw : If true, then if point is not within geo, an error is thrown and the program stops running.

  • sigdigits : Specifies number of significant digits (i.e., precision) of the point coordinates used for checking. Defaults to 10.

Returns

  • tf : A true/false boolean.
source

Is GeoRegion In a GeoRegion

Base.in Method
julia
in(
    cgeo :: GeoRegion,
    geo  :: GeoRegion;
    n    :: Int = 100,
    throw   :: Bool = false,
    verbose :: Bool = false,
    sigdigits :: Int = 10
) -> tf :: Bool

Check if a child GeoRegion defined by cgeo is within another GeoRegion geo.

Arguments

  • cgeo : A GeoRegion that we postulate to be a "child", or a subset of the GeoRegion defined by geo.

  • geo : A GeoRegion that we postulate to be a "parent", or containing the GeoRegion defined by cgeo.

Keyword Arguments

  • n : The number of segments to split each of the GeoRegions into. Default is 100.

  • throw : If true, then if cgeo is not within geo, an error is thrown and the program stops running.

  • verbose : If true, print logs to screen.

  • sigdigits : Specifies number of significant digits (i.e., precision) of the point coordinates used for checking. Defaults to 10.

Returns

  • tf : A true/false boolean.
source

On

Is Point On a GeoRegion

GeoRegions.on Method
julia
on(
    point :: Point2{<:Real},
    geo   :: GeoRegion;
    throw :: Bool = false,
    sigdigits :: Int = 10
) -> tf :: Bool

Check if a geographical point point is on the boundary of a shape of a GeoRegion defined by geo.

Arguments

  • point : A geographical point of Type Point. Pass Point(plon,plat), where plon and plat are the longitude and latitudes of the point.

  • geo : The GeoRegion struct container.

Keyword Arguments

  • throw : If true, then if point is not within geo, an error is thrown and the program stops running.

  • sigdigits : Specifies number of significant digits (i.e., precision) of the point coordinates used for checking. Defaults to 10.

Returns

  • tf : A true/false boolean.
source

Is GeoRegion On a GeoRegion

GeoRegions.on Method
julia
on(
    geo1 :: GeoRegion,
    geo2 :: GeoRegion;
    n    :: Int = 2,
    throw   :: Bool = false,
    verbose :: Bool = false,
    sigdigits :: Int = 10
) -> tf :: Bool

Check if the GeoRegions geo1 and geo2 have the same shape. The order of geo1 and geo2 does not matter.

Arguments

  • geo1 : The first GeoRegion

  • geo2 : The second GeoRegion

Keyword Arguments

  • n : The number of segments to split each of the GeoRegions into. Default is 2.

  • throw : If true, then if geo1 does not have the same shape as geo2, an error is thrown and the program stops running.

  • verbose : If true, print logs to screen.

  • sigdigits : Specifies number of significant digits (i.e., precision) of the point coordinates used for checking. Defaults to 10.

Returns

  • tf : A true/false boolean.
source

Equivalence of GeoRegions

Base.:== Method
julia
==(
    geo1 :: GeoRegion,
    geo2 :: GeoRegion,
) -> tf :: Bool

Checks (a) ID, (b) pID, (c) rotation, and (d) the geometry/shape of two different GeoRegions in order to determine if they are exactly the same.

The geo1.shape and geo2.shape need not be exactly the same as long as they define the same area (i.e., the points in geo2 can be a circshift version of geo1). They can also be offset from each other by 360º.

Arguments

  • geo1 : The first GeoRegion.

  • geo2 : The second GeoRegion.

Returns

  • tf : A true/false boolean.
source
Base.isequal Method
julia
isequal(
    geo1 :: GeoRegion,
    geo2 :: GeoRegion;
    verbose :: Bool = false
) -> tf :: Bool

Checks (a) ID, (b) pID, (c) rotation, and (d) the geometry/shape of two different GeoRegions in order to determine if they are exactly the same.

The geo1.shape and geo2.shape need not be exactly the same as long as they define exactly the same area (i.e., the points in geo2 can be a circshift() version of geo1).

Arguments

  • geo1 : The first GeoRegion.

  • geo2 : The second GeoRegion.

Keyword Arguments

  • verbose : Verbose logging for ease of monitoring? Default is false.

Returns

  • tf : A true/false boolean.
source

Does this GeoRegion already Exist?

GeoRegions.isgeo Method
julia
isgeo(
    geo  :: GeoRegion;
    path :: AbstractString = dirname(geo.path),
    throw   :: Bool = true,
    verbose :: Bool = false
) -> tf :: Bool

Checks all the GeoRegions defined in the project determined by path against a given GeoRegion geo. If there is any GeoRegion tgeo that returns isequal(geo,tgeo) = true, then isgeo(geo) = true. Otherwise, returns false or throws an error.

Arguments

  • geo : The GeoRegion in question.

Keyword Arguments

  • path : The path where the list of custom GeoRegions will be retrieved from. Defaults to the directory geo.path.

  • throw : If true, then throws an error if there is no GeoRegion defined in path with the same characteristics or field values as geo.

  • verbose : Verbose logging for ease of monitoring? Default is false.

Returns

  • tf : A true/false boolean.
source

Equivalence of GeoRegion IDs

GeoRegions.isID Method
julia
isID(
    ID   :: AbstractString;
    path :: AbstractString = homedir(),
    throw   :: Bool = true,
    verbose :: Bool = false
) -> tf :: Bool

Checks if there is a GeoRegion, that exists in the custom lists defined in path, with the ID ID.

Arguments

  • ID : The keyword ID that will be used to identify the GeoRegion. If the ID is not valid (i.e. not being used), then an error will be thrown.

Keyword Arguments

  • path : The path where the list of custom GeoRegions will be retrieved from. Defaults to the current directory pwd().

  • throw : If true, then throws an error if ID is not a valid GeoRegion identifier instead of returning the Boolean tf.

  • verbose : Verbose logging for ease of monitoring? Default is false.

Returns

  • tf : A true/false boolean.
source

Equivalence of GeoRegion Shapes

GeoRegions.isgeoshape Method
julia
isgeoshape(
    geo  :: GeoRegion;
    path :: AbstractString = dirname(geo.path),
    returnID :: Bool = true,
    verbose  :: Bool = false
) -> tf :: Bool

Checks all the GeoRegions defined in the project determined by path. If there exists a GeoRegion tgeo such that on(geo,tgeo) = true, then returns true by default, or otherwise, if returnID is true, it will return tgeo.ID. If there is no GeoRegion with the same shape, then either returns a false or throws and error depending on throw

Arguments

  • geo : The GeoRegion in question.

Keyword Arguments

  • path : The path where GeoRegions will be retrieved from and compared against. Defaults to the directory geo.path.

  • returnID : If true, then returns the ID of the GeoRegion in path with the same shape as geo.

  • verbose : Verbose logging for ease of monitoring? Default is false.

Returns

  • tf : A true/false boolean.
source
GeoRegions.isgeoshape Method
julia
isgeoshape(
    lon  :: Vector{<:Real},
    lat  :: Vector{<:Real};
    path :: AbstractString = dirname(geo.path),
    returnID :: Bool = true,
    verbose  :: Bool = false
) -> tf :: Bool

Checks all the GeoRegions defined in the project determined by path. If there exists a GeoRegion tgeo with the same shape as defined by the vectors lon and lat, returns true by default, or otherwise, if returnID is true, it will return the tgeo.ID. If there is no GeoRegion with the same shape, then either returns a false or throws and error depending on throw

Arguments

  • lon : Vector of longitude points.

  • lat : Vector of latitude points.

Keyword Arguments

  • path : The path where GeoRegions will be retrieved from and compared against. Defaults to the directory homedir().

  • returnID : If true, then returns the ID of the GeoRegion in path with the same shape as geo.

  • verbose : Verbose logging for ease of monitoring? Default is false.

Returns

  • tf : A true/false boolean.
source