Skip to content

Commit 55c23f1

Browse files
committed
Clean up meta docs
1 parent 26f8554 commit 55c23f1

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

docs/src/metadata.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
# Metadata
2+
The `Meta` method provides metadata handling capabilities in GeometryBasics.
3+
4+
### 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+
```
15+
16+
#### Example:
217
```julia
318
p1 = Point(2.2, 3.6)
419

5-
# geometries can carry metadata
620
poi = meta(p1, city="Abuja", rainfall=1221.2)
721
2-element PointMeta{2,Int64,Point{2,Int64},(:city, :rainfall),Tuple{String,Float64}} with indices SOneTo(2):
822
3
@@ -16,7 +30,6 @@ meta(poi)
1630
poi.rainfall
1731
1221.2
1832

19-
# to remove the metadata and keep only the geometry, use metafree
2033
metafree(poi)
2134
2-element Point{2,Int64} with indices SOneTo(2):
2235
3
@@ -27,7 +40,25 @@ multipoi = MultiPointMeta([p1], city="Abuja", rainfall=1221.2)
2740
1-element MultiPointMeta{Point{2,Int64},MultiPoint{2,Int64,Point{2,Int64},Array{Point{2,Int64},1}},(:city, :rainfall),Tuple{String,Float64}}:
2841
[3, 1]
2942
```
43+
In the above example we have also used geometry specific meta methods.
3044

45+
#### Example:
46+
```julia
47+
GeometryBasics.MetaType(Polygon)
48+
PolygonMeta
49+
50+
GeometryBasics.MetaType(Mesh)
51+
MeshMeta
52+
```
53+
The metageometry objects are infact composed of the original geometry types.
54+
```julia
55+
GeometryBasics.MetaFree(PolygonMeta)
56+
Polygon
57+
58+
GeometryBasics.MetaFree(MeshMeta)
59+
Mesh
60+
61+
```
3162
## MetaT
3263
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.
3364

0 commit comments

Comments
 (0)