Domains

Overview

A geospatial domain is a (discretized) region in physical space. For example, a collection of rain gauge stations can be represented as a PointSet in the map. Similarly, a collection of states in a given country can be represented as a GeometrySet of polygons.

We provide flexible domain types for advanced geospatial workflows via the Meshes.jl submodule. The domains can consist of sets (or "soups") of geometries as it is most common in GIS or be actual meshes with topological information.

Meshes.DomainType
Domain{M,CRS}

A domain is an indexable collection of geometries (e.g. mesh) in a given manifold M with point coordinates specified in a coordinate reference system CRS.

source
Meshes.MeshType
Mesh{M,CRS,TP}

A mesh of geometries in a given manifold M with point coordinates specified in a coordinate reference system CRS. Unlike a general domain, a mesh has a well-defined topology TP.

source

Examples

PointSet

Meshes.PointSetType
PointSet(points)

A set of points (a.k.a. point cloud) representing a Domain.

Examples

All point sets below are the same and contain two points in R³:

julia> PointSet([Point(1,2,3), Point(4,5,6)])
julia> PointSet(Point(1,2,3), Point(4,5,6))
julia> PointSet([(1,2,3), (4,5,6)])
julia> PointSet((1,2,3), (4,5,6))
source
pset = PointSet(rand(Point, 100))

viz(pset)
Example block output

GeometrySet

Meshes.GeometrySetType
GeometrySet(geometries)

A set of geometries representing a Domain.

Examples

Set containing two balls centered at (0.0, 0.0) and (1.0, 1.0):

julia> GeometrySet([Ball((0.0, 0.0)), Ball((1.0, 1.0))])

Notes

  • Geometries with different CRS will be projected to the CRS of the first geometry.
source
tria = Triangle((0.0, 0.0), (1.0, 1.0), (0.0, 1.0))
quad = Quadrangle((1.0, 1.0), (2.0, 1.0), (2.0, 2.0), (1.0, 2.0))
gset = GeometrySet([tria, quad])

viz(gset, showsegments = true)
Example block output

CartesianGrid

Meshes.RegularGridType
RegularGrid(dims, origin, spacing)

A regular grid with dimensions dims, lower left corner at origin and cell spacing spacing. The three arguments must have the same length.

RegularGrid(dims, origin, spacing, offset)

A regular grid with dimensions dims, with lower left corner of element offset at origin and cell spacing spacing.

RegularGrid(start, finish, dims=dims)

Alternatively, construct a regular grid from a start point to a finish with dimensions dims.

RegularGrid(start, finish, spacing)

Alternatively, construct a regular grid from a start point to a finish point using a given spacing.

Examples

RegularGrid((10, 20), Point(LatLon(30.0°, 60.0°)), (1.0, 1.0)) # add coordinate units to spacing
RegularGrid((10, 20), Point(Polar(0.0cm, 0.0rad)), (10.0mm, 1.0rad)) # convert spacing units to coordinate units
RegularGrid((10, 20), Point(Mercator(0.0, 0.0)), (1.5, 1.5))
RegularGrid((10, 20, 30), Point(Cylindrical(0.0, 0.0, 0.0)), (3.0, 2.0, 1.0))

See also CartesianGrid.

source
Meshes.CartesianGridType
CartesianGrid(dims, origin, spacing)

A Cartesian grid with dimensions dims, lower left corner at origin and cell spacing spacing. The three arguments must have the same length.

CartesianGrid(dims, origin, spacing, offset)

A Cartesian grid with dimensions dims, with lower left corner of element offset at origin and cell spacing spacing.

CartesianGrid(start, finish, dims=dims)

Alternatively, construct a Cartesian grid from a start point (lower left) to a finish point (upper right).

CartesianGrid(start, finish, spacing)

Alternatively, construct a Cartesian grid from a start point to a finish point using a given spacing.

CartesianGrid(dims)
CartesianGrid(dim1, dim2, ...)

Finally, a Cartesian grid can be constructed by only passing the dimensions dims as a tuple, or by passing each dimension dim1, dim2, ... separately. In this case, the origin and spacing default to (0,0,...) and (1,1,...).

CartesianGrid is an alias to RegularGrid with Cartesian CRS.

Examples

Create a 3D grid with 100x100x50 hexahedrons:

julia> CartesianGrid(100, 100, 50)

Create a 2D grid with 100 x 100 quadrangles and origin at (10.0, 20.0):

julia> CartesianGrid((100, 100), (10.0, 20.0), (1.0, 1.0))

Create a 1D grid from -1 to 1 with 100 segments:

julia> CartesianGrid((-1.0,), (1.0,), dims=(100,))

See also RegularGrid.

source
grid = CartesianGrid(10, 10, 10)

viz(grid, showsegments = true)
Example block output