Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New (breaking) Traits based release #33

Merged
merged 46 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0ce3aaa
Moved from GeoInterfaceRFC.jl
evetion Aug 24, 2020
7f7fa43
Renamed all RFC occurences.
evetion Aug 26, 2020
668dc52
Small update.
evetion Mar 25, 2022
f7fc274
Merge branch 'master' into v1-traits
evetion Mar 25, 2022
d47dd88
Fix review comments.
evetion Mar 25, 2022
5ce639b
Use `isgeometry` as a first check.
evetion Mar 25, 2022
47281c4
Updated integrations.
evetion Mar 25, 2022
27dc9fe
Improved documentation.
evetion Apr 1, 2022
b727c07
Updated docs. Fixed bugs.
evetion Apr 4, 2022
4637713
Update src/defaults.jl
evetion Apr 8, 2022
45dd59a
Update docs/src/guides/developer.md
evetion Apr 8, 2022
2ae9581
Changes based on ArchGDAL implementation.
evetion Apr 10, 2022
b252cd1
Fixed tests.
evetion Apr 10, 2022
33df32f
Reverted Type traits. Suffixed Trait to all types.
evetion Apr 15, 2022
49a4d11
Add Julia Computing as contributor. Fix `isempty` and add `convert` m…
evetion Apr 23, 2022
7af21e4
Add `asbinary` and `astext` (wkb and wkt) methods.
evetion Apr 25, 2022
1ba01f5
Added iterators. Added feature interface. Updated documentation based…
evetion May 3, 2022
e6feb6b
Removed unused import.
evetion May 3, 2022
0df59c9
add getring function to the interface
rafaqz May 1, 2022
497abd3
add getpoint iterators
rafaqz May 3, 2022
40c4bcc
bugfix defaults
rafaqz May 3, 2022
b15d130
fix functions and standardise iterator docstrings
rafaqz May 3, 2022
c537100
bugfix
rafaqz May 3, 2022
49644d7
Merge pull request #47 from JuliaGeo/rs/getrings
evetion May 3, 2022
9ab7e2c
Fixed doc reference. Removed duplicate getring function.
evetion May 8, 2022
7ee9ace
Added doctests. Expanded the documentation.
evetion May 8, 2022
1805746
Fixed bug in coordinates.
evetion May 8, 2022
567683b
Fix bug in x, y, z, m lookup in getcoord.
evetion May 9, 2022
ddee198
Improved performance of coordinate name lookup.
evetion May 9, 2022
6303188
standardise trait arg passing
rafaqz May 9, 2022
66b68e4
Merge pull request #48 from JuliaGeo/rs/standardise_traitargs
evetion May 9, 2022
3305aef
Completed subtrait method.
evetion May 10, 2022
19946d7
Fixed doctest.
evetion May 11, 2022
fa4a26d
Fixed bugs in nested iterator. Expanded tests and enabled code coverage.
evetion May 12, 2022
4630f13
rename defaults.jl to fallbacks.jl
visr May 15, 2022
2c00af7
editing
visr May 15, 2022
69b38a7
replace argument _ with geom
visr May 15, 2022
7bef237
drop module name for exported functions
visr May 15, 2022
d1d9589
fix tests
visr May 15, 2022
f98a139
export the traits
visr May 15, 2022
cfadd5e
Merge pull request #50 from JuliaGeo/export-traits
evetion May 15, 2022
ccd276a
Update .github/workflows/CI.yml
evetion May 15, 2022
8468fa9
Merge pull request #49 from JuliaGeo/check
evetion May 15, 2022
2cc0e07
Expanded tests.
evetion May 15, 2022
a22db09
Documented conversion interface.
evetion May 16, 2022
b5f5675
Expanded test coverage more.
evetion May 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.7"
evetion marked this conversation as resolved.
Show resolved Hide resolved
- "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()'
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
*.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"]
83 changes: 11 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,15 @@
# 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

## 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, 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