Skip to content

A shared Extent object for Julia spatial data, with DE-9IM spatial predicates

License

Notifications You must be signed in to change notification settings

rafaqz/Extents.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extents

Stable Dev Build Status Coverage

Extents.jl is a small package that defines an Extent object that can be used by the different Julia spatial data packages. Extent is a wrapper for a NamedTuple of tuples holding the lower and upper bounds for each dimension of a object. It is used in GeoInterface.jl, as the required return type for the extent function, and in DimensionalData.jl and Rasters.jl to subset arrays with named dimensions.

Quick start

julia> using Extents

julia> ext1 = Extent(X = (1.0, 2.0), Y = (3.0, 4.0))

julia> ext2 = Extent(X = (1.5, 2.5), Y = (3.0, 4.0))

julia> # find the dimensions

julia> keys(ext1)
(:X, :Y)

julia> # get the extent for a single dimension by name

julia> ext1.X
(1.0, 2.0)

julia> # get the underlying NamedTuple

julia> bounds(ext1)
(X = (1.0, 2.0), Y = (3.0, 4.0))

julia> Extents.intersection(ext1, ext2)
Extent(X = (1.5, 2.0), Y = (3.0, 4.0))

julia> Extents.union(ext1, ext2)
Extent(X = (1.0, 2.5), Y = (3.0, 4.0))

Extents.jl also defines spatial predicates following the DE-9IM standard.

julia> Extents.intersects(ext1, ext2)
true

julia> Extents.disjoint(ext1, ext2)
false

julia> Extents.touches(ext1, ext2)
false

julia> Extents.overlaps(ext1, ext2)
true

See the docs for all available methods.

About

A shared Extent object for Julia spatial data, with DE-9IM spatial predicates

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages