Skip to content

Commit 345a5ef

Browse files
committed
Used Documenter.jl formats
1 parent 09f0997 commit 345a5ef

File tree

1 file changed

+27
-30
lines changed

1 file changed

+27
-30
lines changed

docs/src/metadata.md

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
# Metadata
2-
The `Meta` method provides metadata handling capabilities in GeometryBasics.
2+
## Meta
3+
The `Meta` method provides metadata handling capabilities in GeometryBasics. Similarly to remove the metadata and keep only the geometry, use `metafree`, and for vice versa i.e., remove the geometry and keep the metadata use `meta`.
4+
35

46
### Syntax
5-
```julia
6-
meta(geometry, meta::NamedTuple)
7-
meta(geometry; meta...)
8-
```
9-
To remove the metadata and keep only the geometry, use `metafree`, and for vice versa i.e., remove the geometry and keep the metadata use `meta`.
10-
### Syntax
11-
```julia
12-
metafree(meta-geometry)
13-
meta(meta-geometry)
14-
```
7+
```
8+
meta(geometry, meta::NamedTuple)
9+
meta(geometry; meta...)
1510
16-
#### Example:
17-
```julia
11+
metafree(meta-geometry)
12+
meta(meta-geometry)
13+
```
14+
### Example
15+
```jldoctest
16+
using GemetryBasics
1817
p1 = Point(2.2, 3.6)
1918
2019
poi = meta(p1, city="Abuja", rainfall=1221.2)
@@ -42,52 +41,51 @@ multipoi = MultiPointMeta([p1], city="Abuja", rainfall=1221.2)
4241
```
4342
In the above example we have also used geometry specific meta methods.
4443

45-
#### Example:
46-
```julia
44+
### Example
45+
```@jldoctest
4746
GeometryBasics.MetaType(Polygon)
4847
PolygonMeta
4948
5049
GeometryBasics.MetaType(Mesh)
5150
MeshMeta
5251
```
5352
The metageometry objects are infact composed of the original geometry types.
54-
```julia
53+
```@jldoctest
5554
GeometryBasics.MetaFree(PolygonMeta)
5655
Polygon
5756
5857
GeometryBasics.MetaFree(MeshMeta)
5958
Mesh
60-
6159
```
6260
## MetaT
63-
In GeometryBasics we can a have tabular layout for a collection meta-geometries by putting them into a StructArray that extends the Tables.jl API.
61+
In GeometryBasics we can a have tabular layout for a collection of meta-geometries by putting them into a StructArray that extends the [Tables.jl](https://github.com/JuliaData/Tables.jl) API.
6462

65-
In practice it's not necessary for the geometry or metadata types to be consistent. Eg: A .geojson format can have heterogeneous geometries.
63+
In practice it's not necessary for the geometry or metadata types to be consistent. Eg: A geojson format can have heterogeneous geometries.
6664
Hence, such cases require automatic widening of the geometry data types to the most appropriate type. The MetaT method works around the fact that, a collection of geometries and metadata of different types can be represented tabularly whilst widening to the appropriate type.
6765
### Syntax
68-
```julia
69-
MetaT(geometry, meta::NamedTuple)
70-
MetaT(geometry; meta...)
66+
```
67+
MetaT(geometry, meta::NamedTuple)
68+
MetaT(geometry; meta...)
7169
```
7270
Returns a `MetaT` that holds a geometry and its metadata `MetaT` acts the same as `Meta` method.
7371
The difference lies in the fact that it is designed to handle geometries and metadata of different/heterogeneous types.
7472

7573
eg: While a Point MetaGeometry is a `PointMeta`, the MetaT representation is `MetaT{Point}`
7674

77-
#### Example:
78-
```julia
75+
### Example
76+
```@jldoctest
7977
MetaT(Point(1, 2), city = "Mumbai")
8078
MetaT{Point{2,Int64},(:city,),Tuple{String}}([1, 2], (city = "Mumbai",))
8179
```
8280

8381
For a tabular representation, an iterable of `MetaT` types can be passed on to a `metatable` method.
8482

8583
### Syntax
86-
```julia
87-
meta_table(iter)
84+
```@jldoctest
85+
meta_table(iter)
8886
```
89-
#### Example:
90-
```julia
87+
### Example
88+
```@jldoctest
9189
using DataFrames
9290
# Create an array of 2 linestrings
9391
ls = [LineString([Point(i, i+1), Point(i-1,i+5)]) for i in 1:2]
@@ -116,7 +114,6 @@ sa.rainfall
116114
```
117115

118116
### Disadvantages:
119-
* The MetaT is pretty generic in terms of geometry types, it's not subtype to geometries.
120-
eg : A `MetaT{Point, NamedTuple{Names, Types}}` is not subtyped to `AbstractPoint` like a `PointMeta` is.
117+
* The MetaT is pretty generic in terms of geometry types, it's not subtype to geometries. eg : A `MetaT{Point, NamedTuple{Names, Types}}` is not subtyped to `AbstractPoint` like a `PointMeta` is.
121118
* This might cause problems on using `MetaT` with other constructors/methods inside or even outside GeometryBasics methods designed to work with the main `Meta` types.
122119

0 commit comments

Comments
 (0)