Skip to content

Commit 2c00af7

Browse files
committed
editing
1 parent 4630f13 commit 2c00af7

File tree

7 files changed

+61
-65
lines changed

7 files changed

+61
-65
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44
/docs/build/
55
.DS_Store
66
docs/src/reference/integrations.md
7-

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
[![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)
44

55
# GeoInterface
6-
An interface for geospatial vector data in Julia
6+
An interface for geospatial vector data in [Julia](https://julialang.org/).
77

8-
This Package describe a set of traits based on the [Simple Features standard (SF)](https://www.opengeospatial.org/standards/sfa)
9-
for geospatial vector data, including the SQL/MM extension with support for circular geometry.
10-
Using these traits, it should be easy to parse, serialize and use different geometries in the Julia ecosystem,
11-
without knowing the specifics of each individual package. In that regard it is similar to Tables.jl, but for geometries instead of tables.
8+
This Package describe a set of traits based on the [Simple Features standard
9+
(SF)](https://www.opengeospatial.org/standards/sfa) for geospatial vector data, including
10+
the SQL/MM extension with support for circular geometry. Using these traits, it should be
11+
easy to parse, serialize and use different geometries in the Julia ecosystem, without
12+
knowing the specifics of each individual package. In that regard it is similar to
13+
[Tables.jl](https://github.com/JuliaData/Tables.jl), but for geometries instead of tables.
1214

13-
Packages which support the GeoInterface.jl interface can be found in [INTEGRATIONS.md](INTEGRATIONS.md).
15+
Packages which support the GeoInterface.jl interface can be found in
16+
[INTEGRATIONS.md](INTEGRATIONS.md).
1417

1518
We thank Julia Computing for supporting contributions to this package.

find_integrations.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
###
77
### Usage
88
###
9-
### 1. ensure a development version of Tables.jl (`pkg> add GeoInterface`)
9+
### 1. ensure a development version of GeoInterface.jl (`pkg> add GeoInterface`)
1010
### 2. make sure the General registry is up to date (`pkg> up`)
1111
### 3. run this script, which uses the first depot from DEPOT_PATH
1212

1313
DEPOT = first(DEPOT_PATH)
1414
REGISTRIES = joinpath(DEPOT, "registries")
1515
@info DEPOT
16-
# find each package w/ a direct dependency on Tables.jl
16+
# find each package w/ a direct dependency on GeoInterface.jl
1717
general = joinpath(DEPOT, "General")
1818
mkpath(general)
1919
# run(`tar -xzf General.tar.gz -C $general`)

src/GeoInterface.jl

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
module GeoInterface
22

3-
using Base.Iterators
3+
using Base.Iterators: flatten
4+
5+
export testgeometry, isgeometry, geomtype, ncoord, getcoord, ngeom, getgeom
46

57
include("types.jl")
68
include("interface.jl")
79
include("fallbacks.jl")
810
include("utils.jl")
911

10-
export testgeometry
11-
export isgeometry
12-
13-
export geomtype
14-
export ncoord
15-
export getcoord
16-
export ngeom
17-
export getgeom
18-
1912
end # module

src/fallbacks.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Defaults for many of the interface functions are defined here as fallback.
2-
# Methods here should take a type as first argument and should already be defined
2+
# Methods here should take a trait instance as first argument and should already be defined
33
# in the `interface.jl` first as a generic f(geom) method.
44

55
## Coords
@@ -107,8 +107,8 @@ end
107107
"""
108108
subtrait(t::AbstractGeometryTrait)
109109
110-
Gets the expected, possible abstract, (sub)trait for subgeometries (retrieved with [`getgeom`](@ref)) of trait `t`.
111-
This follows the [Type hierarchy](@ref) of Simple Features.
110+
Gets the expected, possible abstract, (sub)trait for subgeometries (retrieved with
111+
[`getgeom`](@ref)) of trait `t`. This follows the [Type hierarchy](@ref) of Simple Features.
112112
113113
# Examples
114114
```jldoctest; setup = :(using GeoInterface)

src/interface.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
GeoInterface.isgeometry(x) => Bool
44
5-
Check if an object `x` is a geometry and thus implicitely supports GeoInterface methods.
5+
Check if an object `x` is a geometry and thus implicitly supports GeoInterface methods.
66
It is recommended that for users implementing `MyType`, they define only
77
`isgeometry(::Type{MyType})`. `isgeometry(::MyType)` will then automatically delegate to this
88
method.
@@ -13,12 +13,13 @@ isgeometry(::Type{T}) where {T} = false
1313
"""
1414
GeoInterface.isfeature(x) => Bool
1515
16-
Check if an object `x` is a feature and thus implicitely supports some GeoInterface methods.
16+
Check if an object `x` is a feature and thus implicitly supports some GeoInterface methods.
1717
A feature is a combination of a geometry and properties, not unlike a row in a table.
1818
It is recommended that for users implementing `MyType`, they define only
1919
`isfeature(::Type{MyType})`. `isfeature(::MyType)` will then automatically delegate to this
2020
method.
21-
Ensures backwards compatibility with the older GeoInterface.
21+
22+
Ensures backwards compatibility with GeoInterface version 0.
2223
"""
2324
isfeature(x::T) where {T} = isfeature(T)
2425
isfeature(::Type{T}) where {T} = false
@@ -27,15 +28,15 @@ isfeature(::Type{T}) where {T} = false
2728
GeoInterface.geometry(feat) => geom
2829
2930
Retrieve the geometry of `feat`. It is expected that `isgeometry(geom) === true`.
30-
Ensures backwards compatibility with the older GeoInterface.
31+
Ensures backwards compatibility with GeoInterface version 0.
3132
"""
3233
geometry(feat) = nothing
3334

3435
"""
3536
GeoInterface.properties(feat) => properties
3637
3738
Retrieve the properties of `feat`. This can be any Iterable that behaves like an AbstractRow.
38-
Ensures backwards compatibility with the older GeoInterface.
39+
Ensures backwards compatibility with GeoInterface version 0.
3940
"""
4041
properties(feat) = nothing
4142

@@ -375,7 +376,7 @@ extent(geom) = extent(geomtype(geom), geom)
375376
376377
Alias for [`extent`](@ref), for compatibility with
377378
GeoJSON and the Python geointerface.
378-
Ensures backwards compatibility with the older GeoInterface.
379+
Ensures backwards compatibility with GeoInterface version 0.
379380
"""
380381
bbox(geom) = extent(geom)
381382

@@ -550,7 +551,7 @@ ismeasured(geom) = ismeasured(geomtype(geom), geom)
550551
coordinates(geom) -> Vector
551552
552553
Return (an iterator of) point coordinates.
553-
Ensures backwards compatibility with the older GeoInterface.
554+
Ensures backwards compatibility with GeoInterface version 0.
554555
"""
555556
coordinates(geom) = coordinates(geomtype(geom), geom)
556557

src/types.jl

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,81 @@
1-
"""An AbstractGeometryTrait type for all geometries."""
1+
"An AbstractGeometryTrait type for all geometries."
22
abstract type AbstractGeometryTrait end
33

4-
"""An AbstractGeometryCollectionTrait type for all geometrycollections."""
4+
"An AbstractGeometryCollectionTrait type for all geometrycollections."
55
abstract type AbstractGeometryCollectionTrait <: AbstractGeometryTrait end
6-
"""A GeometryCollection is a collection of `Geometry`s."""
6+
"A GeometryCollection is a collection of `Geometry`s."
77
struct GeometryCollectionTrait <: AbstractGeometryCollectionTrait end
88

9-
"""An AbstractPointTrait for all points."""
9+
"An AbstractPointTrait for all points."
1010
abstract type AbstractPointTrait <: AbstractGeometryTrait end
11-
"""A single point."""
11+
"A single point."
1212
struct PointTrait <: AbstractPointTrait end
1313

14-
"""An AbstractCurveTrait type for all curves."""
14+
"An AbstractCurveTrait type for all curves."
1515
abstract type AbstractCurveTrait <: AbstractGeometryTrait end
16-
"""An AbstractLineString type for all linestrings."""
16+
"An AbstractLineString type for all linestrings."
1717
abstract type AbstractLineStringTrait <: AbstractCurveTrait end
18-
"""A LineStringTrait is a collection of straight lines between its `PointTrait`s."""
18+
"A LineStringTrait is a collection of straight lines between its `PointTrait`s."
1919
struct LineStringTrait <: AbstractLineStringTrait end
20-
"""A LineTrait is [`LineStringTrait`](@ref) with just two points."""
20+
"A LineTrait is [`LineStringTrait`](@ref) with just two points."
2121
struct LineTrait <: AbstractLineStringTrait end
22-
"""A LinearRingTrait is a [`LineStringTrait`](@ref) with the same begin and endpoint."""
22+
"A LinearRingTrait is a [`LineStringTrait`](@ref) with the same begin and endpoint."
2323
struct LinearRingTrait <: AbstractLineStringTrait end
2424

25-
"""A CircularStringTrait is a curve, with an odd number of points.
25+
"A CircularStringTrait is a curve, with an odd number of points.
2626
A single segment consists of three points, where the first and last are the beginning and end,
27-
while the second is halfway the curve."""
27+
while the second is halfway the curve."
2828
struct CircularStringTrait <: AbstractCurveTrait end
29-
"""A CompoundCurveTrait is a curve that combines straight [`LineStringTrait`](@ref)s and curved [`CircularStringTrait`](@ref)s."""
29+
"A CompoundCurveTrait is a curve that combines straight [`LineStringTrait`](@ref)s and curved [`CircularStringTrait`](@ref)s."
3030
struct CompoundCurveTrait <: AbstractCurveTrait end
3131

32-
"""An AbstractSurfaceTrait type for all surfaces."""
32+
"An AbstractSurfaceTrait type for all surfaces."
3333
abstract type AbstractSurfaceTrait <: AbstractGeometryTrait end
34-
"""An AbstractCurvePolygonTrait type for all curved polygons."""
34+
"An AbstractCurvePolygonTrait type for all curved polygons."
3535
abstract type AbstractCurvePolygonTrait <: AbstractSurfaceTrait end
36-
"""An [`AbstractCurvePolygonTrait`](@ref) that can contain either circular or straight curves as rings."""
36+
"An [`AbstractCurvePolygonTrait`](@ref) that can contain either circular or straight curves as rings."
3737
struct CurvePolygonTrait <: AbstractCurvePolygonTrait end
38-
"""An AbstractPolygonTrait type for all polygons."""
38+
"An AbstractPolygonTrait type for all polygons."
3939
abstract type AbstractPolygonTrait <: AbstractCurvePolygonTrait end
40-
"""An [`AbstractSurfaceTrait`](@ref) with straight rings either as exterior or interior(s)."""
40+
"An [`AbstractSurfaceTrait`](@ref) with straight rings either as exterior or interior(s)."
4141
struct PolygonTrait <: AbstractPolygonTrait end
42-
"""A [`PolygonTrait`](@ref) that is triangular."""
42+
"A [`PolygonTrait`](@ref) that is triangular."
4343
struct TriangleTrait <: AbstractPolygonTrait end
44-
"""A [`PolygonTrait`](@ref) that is rectangular and could be described by the minimum and maximum vertices."""
44+
"A [`PolygonTrait`](@ref) that is rectangular and could be described by the minimum and maximum vertices."
4545
struct RectangleTrait <: AbstractPolygonTrait end
46-
"""A [`PolygonTrait`](@ref) with four vertices."""
46+
"A [`PolygonTrait`](@ref) with four vertices."
4747
struct QuadTrait <: AbstractPolygonTrait end
48-
"""A [`PolygonTrait`](@ref) with five vertices."""
48+
"A [`PolygonTrait`](@ref) with five vertices."
4949
struct PentagonTrait <: AbstractPolygonTrait end
50-
"""A [`PolygonTrait`](@ref) with six vertices."""
50+
"A [`PolygonTrait`](@ref) with six vertices."
5151
struct HexagonTrait <: AbstractPolygonTrait end
5252

53-
"""An AbstractPolyHedralSurfaceTrait type for all polyhedralsurfaces."""
53+
"An AbstractPolyHedralSurfaceTrait type for all polyhedralsurfaces."
5454
abstract type AbstractPolyHedralSurfaceTrait <: AbstractSurfaceTrait end
55-
"""A PolyHedralSurfaceTrait is a connected surface consisting of [`PolygonTrait`](@ref)s."""
55+
"A PolyHedralSurfaceTrait is a connected surface consisting of [`PolygonTrait`](@ref)s."
5656
struct PolyHedralSurfaceTrait <: AbstractPolyHedralSurfaceTrait end
57-
"""A TINTrait is a [`PolyHedralSurfaceTrait`](@ref) consisting of [`TriangleTrait`](@ref)s."""
57+
"A TINTrait is a [`PolyHedralSurfaceTrait`](@ref) consisting of [`TriangleTrait`](@ref)s."
5858
struct TINTrait <: AbstractPolyHedralSurfaceTrait end # Surface consisting of Triangles
5959

60-
"""An AbstractMultiPointTrait type for all multipoints."""
60+
"An AbstractMultiPointTrait type for all multipoints."
6161
abstract type AbstractMultiPointTrait <: AbstractGeometryCollectionTrait end
62-
"""A MultiPointTrait is a collection of [`PointTrait`](@ref)s."""
62+
"A MultiPointTrait is a collection of [`PointTrait`](@ref)s."
6363
struct MultiPointTrait <: AbstractMultiPointTrait end
6464

65-
"""An AbstractMultiCurveTrait type for all multicurves."""
65+
"An AbstractMultiCurveTrait type for all multicurves."
6666
abstract type AbstractMultiCurveTrait <: AbstractGeometryCollectionTrait end
67-
"""A MultiCurveTrait is a collection of [`CircularStringTrait`](@ref)s."""
67+
"A MultiCurveTrait is a collection of [`CircularStringTrait`](@ref)s."
6868
struct MultiCurveTrait <: AbstractMultiCurveTrait end
69-
"""An AbstractMultiLineStringTrait type for all multilinestrings."""
69+
"An AbstractMultiLineStringTrait type for all multilinestrings."
7070
abstract type AbstractMultiLineStringTrait <: AbstractMultiCurveTrait end
71-
"""A MultiLineStringTrait is a collection of [`LineStringTrait`](@ref)s."""
71+
"A MultiLineStringTrait is a collection of [`LineStringTrait`](@ref)s."
7272
struct MultiLineStringTrait <: AbstractMultiLineStringTrait end
7373

74-
"""An AbstractMultiSurfaceTrait type for all multisurfaces."""
74+
"An AbstractMultiSurfaceTrait type for all multisurfaces."
7575
abstract type AbstractMultiSurfaceTrait <: AbstractGeometryCollectionTrait end
76-
"""A MultiSurfaceTrait is a collection of [`AbstractSurfaceTrait`](@ref)s."""
76+
"A MultiSurfaceTrait is a collection of [`AbstractSurfaceTrait`](@ref)s."
7777
struct MultiSurfaceTrait <: AbstractMultiSurfaceTrait end
78-
"""An AbstractMultiPolygonTrait type for all multipolygons."""
78+
"An AbstractMultiPolygonTrait type for all multipolygons."
7979
abstract type AbstractMultiPolygonTrait <: AbstractMultiSurfaceTrait end
80-
"""A MultiPolygonTrait is a collection of [`PolygonTrait`](@ref)s."""
80+
"A MultiPolygonTrait is a collection of [`PolygonTrait`](@ref)s."
8181
struct MultiPolygonTrait <: AbstractMultiPolygonTrait end

0 commit comments

Comments
 (0)