Skip to content

Commit

Permalink
Merge pull request #33 from JuliaGeo/v1-traits
Browse files Browse the repository at this point in the history
New (breaking) Traits based release
  • Loading branch information
evetion committed May 16, 2022
2 parents 5faebcf + b5f5675 commit d8c7c22
Show file tree
Hide file tree
Showing 30 changed files with 1,878 additions and 558 deletions.
53 changes: 33 additions & 20 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
name: CI
on:
pull_request:
push:
branches:
- master
tags: '*'
- main
tags: "*"
pull_request:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
Expand All @@ -13,13 +18,11 @@ jobs:
fail-fast: false
matrix:
version:
- '1.0'
- '1'
- 'nightly'
- "1"
- "1.6"
- "nightly"
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
steps:
Expand All @@ -28,19 +31,29 @@ jobs:
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v2
with:
files: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
file: lcov.info
version: "1"
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
- run: |
julia --project=docs -e '
using Documenter: DocMeta, doctest
using GeoInterface
DocMeta.setdocmeta!(GeoInterface, :DocTestSetup, :(using GeoInterface); recursive=true)
doctest(GeoInterface)'
24 changes: 4 additions & 20 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,10 @@ jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: "Add the General registry via Git"
run: |
import Pkg
ENV["JULIA_PKG_SERVER"] = ""
Pkg.Registry.add("General")
shell: julia --color=yes {0}
- name: "Install CompatHelper"
run: |
import Pkg
name = "CompatHelper"
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
version = "3"
Pkg.add(; name, uuid, version)
shell: julia --color=yes {0}
- name: "Run CompatHelper"
run: |
import CompatHelper
CompatHelper.main()
shell: julia --color=yes {0}
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
# COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
*.jl.cov
*.jl.mem
/Manifest.toml
/docs/build/
.DS_Store
docs/src/reference/integrations.md
17 changes: 17 additions & 0 deletions INTEGRATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Packages
Packages currently integrating with GeoInterface.jl:
* [AlgebraOfGraphics](https://github.com/JuliaPlots/AlgebraOfGraphics.jl.git)
* [ArchGDAL](https://github.com/yeesian/ArchGDAL.jl.git)
* [GADM](https://github.com/JuliaGeo/GADM.jl.git)
* [GeoData](https://github.com/rafaqz/GeoData.jl.git)
* [GeoDatasets](https://github.com/JuliaGeo/GeoDatasets.jl.git)
* [GeoJSON](https://github.com/JuliaGeo/GeoJSON.jl.git)
* [GeoMakie](https://github.com/JuliaPlots/GeoMakie.jl.git)
* [GeoTables](https://github.com/JuliaEarth/GeoTables.jl.git)
* [LibGEOS](https://github.com/JuliaGeo/LibGEOS.jl.git)
* [Mangal](https://github.com/EcoJulia/Mangal.jl.git)
* [OmniSci](https://github.com/omnisci/OmniSci.jl.git)
* [Rasters](https://github.com/rafaqz/Rasters.jl.git)
* [Shapefile](https://github.com/JuliaGeo/Shapefile.jl.git)
* [SpatialDependence](https://github.com/javierbarbero/SpatialDependence.jl.git)
* [Turf](https://github.com/philoez98/Turf.jl.git)
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The GeoInterface.jl package is licensed under the MIT "Expat" License:

> Copyright (c) 2015: Yeesian Ng.
> Copyright (c) 2015: Yeesian Ng, Julia Computing
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
Expand Down
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name = "GeoInterface"
uuid = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
license = "MIT"
version = "0.5.7"
authors = ["JuliaGeo and contributors"]
version = "1.0.0"

[deps]
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910"

[compat]
RecipesBase = "0.6, 0.7, 0.8, 1.0"
julia = "1"

[extras]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["Test", "Documenter"]
86 changes: 14 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,18 @@
# GeoInterface.jl
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliageo.github.io/GeoInterface.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliageo.github.io/GeoInterface.jl/dev)
[![Build Status](https://github.com/JuliaGeo/GeoInterface.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaGeo/GeoInterface.jl/actions/workflows/CI.yml?query=branch%3Amain)

A Julia Protocol for Geospatial Data
# GeoInterface
An interface for geospatial vector data in [Julia](https://julialang.org/).

## Motivation
To support operations or visualization of multiple (but similar) implementations of vector data (across `GeoJSON.jl`, `LibGEOS.jl`, etc). As a starting point, it will follow the [GEO interface](https://gist.github.com/sgillies/2217756) [1] in Python (which in turn borrows its design from the [GeoJSON specification](http://geojson.org/) [2]).
This Package describe a set of traits based on the [Simple Features standard
(SF)](https://www.opengeospatial.org/standards/sfa) for geospatial vector data, including
the SQL/MM extension with support for circular geometry. Using these traits, it should be
easy to parse, serialize and use different geometries in the Julia ecosystem, without
knowing the specifics of each individual package. In that regard it is similar to
[Tables.jl](https://github.com/JuliaData/Tables.jl), but for geometries instead of tables.

## GEO Interface
Packages which support the GeoInterface.jl interface can be found in
[INTEGRATIONS.md](INTEGRATIONS.md).

### AbstractPosition
A position can be thought of as a tuple of numbers. There must be at least two elements, and may be more. The order of elements must follow `x`, `y`, `z` order (e.g. easting, northing, altitude for coordinates in a projected coordinate reference system, or longitude, latitude, altitude for coordinates in a geographic coordinate reference system). It requires the following methods:

- `xcoord(::AbstractPosition)::Float64`
- `ycoord(::AbstractPosition)::Float64`
- `zcoord(::AbstractPosition)::Float64`
- `hasz(::AbstractPosition)::Bool` (`false` by default)

Remark: Although the specification allows the representation of up to 3 dimensions, not all algorithms support require all 3 dimensions. Also, if you are working with an arbitrary `obj::AbstractPosition`, you should call `hasz(obj)` before calling `zcoord(obj)`.

### AbstractGeometry
Represents vector geometry, and encompasses the following abstract types: `AbstractPoint, AbstractMultiPoint, AbstractLineString, AbstractMultiLineString, AbstractMultiPolygon, AbstractPolygon`. It requires the `coordinates` method, where

- `coordinates(::AbstractPoint)` returns a single position.
- `coordinates(::AbstractMultiPoint)` returns a vector of positions.
- `coordinates(::AbstractLineString)` returns a vector of positions.
- `coordinates(::AbstractMultiLineString)` returns a vector of linestrings.
- `coordinates(::AbstractPolygon)` returns a vector of linestrings.
- `coordinates(::AbstractMultiPolygon)` returns a vector of polygons.

### AbstractGeometryCollection
Represents a collection of geometries, and requires the `geometries` method, which returns a vector of geometries. Is also a subtype of `AbstractGeometry`.

### AbstractFeature
Represents a geometry with additional attributes, and requires the following methods

- `geometry(::AbstractFeature)::AbstractGeometry` returns the corresponding geometry
- `properties(::AbstractFeature)::Dict{AbstractString,Any}` returns a dictionary of the properties

Optionally, you can also provide the following methods

- `bbox(::AbstractFeature)::AbstractGeometry` returns the bounding box for that feature
- `crs(::AbstractFeature)::Dict{AbstractString,Any}` returns the coordinate reference system

## Geospatial Geometries
If you don't need to provide your own user types, GeoInterface also provides a set of geometries (below), which implements the GEO Interface:

- `CRS`
- `Position`
- `Geometry <: AbstractGeometry`
- `Point <: AbstractPoint <: AbstractGeometry`
- `MultiPoint <: AbstractMultiPoint <: AbstractGeometry`
- `LineString <: AbstractLineString <: AbstractGeometry`
- `MultiLineString <: AbstractMultiLineString <: AbstractGeometry`
- `Polygon <: AbstractPolygon <: AbstractGeometry`
- `MultiPolygon <: AbstractMultiPolygon <: AbstractGeometry`
- `GeometryCollection <: AbstractGeometryCollection <: AbstractGeometry`
- `Feature <: AbstractFeature`
- `FeatureCollection <: AbstractFeatureCollection`

## Remarks

Conceptually,

- an `::AbstractGeometryCollection` maps to a `DataArray{::AbstractGeometry}`, and
- an `::AbstractFeatureCollection` maps to a `DataFrame`, where each row is an `AbstractFeature`

The design of the types in GeoInterface differs from the GeoJSON specification in the following ways:

- Julia Geometries do not provide a `bbox` and `crs` method. If you wish to provide a `bbox` or `crs` attribute, wrap the geometry into a `Feature` or `FeatureCollection`.
- Features do not have special fields for `id`, `bbox`, and `crs`. These are to be provided (or found) in the `properties` field, under the keys `featureid`, `bbox`, and `crs` respectively (if they exist).

## References

[1]: A Python Protocol for Geospatial Data ([gist](https://gist.github.com/sgillies/2217756))

[2]: GeoJSON Specification ([website](http://geojson.org/))
We thank Julia Computing for supporting contributions to this package.
111 changes: 111 additions & 0 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.7.2"
manifest_format = "2.0"

[[deps.ANSIColoredPrinters]]
git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
version = "0.0.1"

[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"

[[deps.DocStringExtensions]]
deps = ["LibGit2"]
git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.6"

[[deps.Documenter]]
deps = ["ANSIColoredPrinters", "Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
git-tree-sha1 = "7d9a46421aef53cbd6b8ecc40c3dcbacbceaf40e"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "0.27.15"

[[deps.Extents]]
git-tree-sha1 = "a087a23129ac079d43ba6b534c6350325fcd41c9"
uuid = "411431e0-e8b7-467b-b5e0-f676ba4f2910"
version = "0.1.0"

[[deps.GeoInterface]]
deps = ["Extents", "RecipesBase"]
path = ".."
uuid = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
version = "1.0.0"

[[deps.IOCapture]]
deps = ["Logging", "Random"]
git-tree-sha1 = "f7be53659ab06ddc986428d3a9dcc95f6fa6705a"
uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
version = "0.2.2"

[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "3c837543ddb02250ef42f4738347454f95079d4e"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.3"

[[deps.LibGit2]]
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"

[[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[deps.Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[deps.Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"

[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"

[[deps.Parsers]]
deps = ["Dates"]
git-tree-sha1 = "621f4f3b4977325b9128d5fae7a8b4829a0c2222"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.2.4"

[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[[deps.REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

[[deps.Random]]
deps = ["SHA", "Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[deps.RecipesBase]]
git-tree-sha1 = "6bf3f380ff52ce0832ddd3a2a7b9538ed1bcca7d"
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version = "1.2.1"

[[deps.SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
Loading

0 comments on commit d8c7c22

Please sign in to comment.