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

[Breaking] Maintain a closed environment of GDAL-compatible types #179

Merged
merged 174 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from 115 commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
928e88b
ignore .DS_Store files
yeesian Apr 18, 2021
fd95b3f
Return errors for unknown datatypes when looking up gdaltypes
yeesian Apr 18, 2021
52a183a
bugfix for looking up julia datatypes when given a gdaldatatype
yeesian Apr 18, 2021
95fb4db
throw informative error message for unknown field types
yeesian Apr 18, 2021
d09334d
Add instructions for managing dependencies
yeesian Apr 18, 2021
d317029
remove cenum dependency
yeesian Apr 18, 2021
de98ada
[Breaking change] Maintain our own OGRFieldType
yeesian Apr 18, 2021
36085e9
[stylistic] Require explicit return statements and enforce maxcolumnw…
yeesian Apr 19, 2021
9bb0304
Update the types in the API to be based on julia types (rather than C…
yeesian Apr 19, 2021
aa380f3
[Breaking change] Introduce types for wkbGeometryType
yeesian Apr 19, 2021
d9ea813
Encapsulate the tests in their own testsets for better organization o…
yeesian Apr 19, 2021
912cb88
Refactor src/types.jl
yeesian Apr 19, 2021
91a6af5
annotate function signatures with return types
yeesian Apr 19, 2021
1175f14
[Breaking] copywholeraster -> copywholeraster!
yeesian Apr 24, 2021
1411c79
annotate with return types
yeesian Apr 25, 2021
cc82bf3
[Breaking] Deprecate serializeJSON
yeesian Apr 25, 2021
0a6755d
[Breaking] _dataset_type -> pixeltype
yeesian Apr 25, 2021
8e7c37d
Annotate with return types
yeesian Apr 25, 2021
f96f2c2
Fix the implementation of src/tables.jl
yeesian Apr 25, 2021
cea217f
Annotate with return types
yeesian Apr 25, 2021
7a785d4
tighten the return type
yeesian Apr 25, 2021
62ccf75
white spacing
yeesian Apr 25, 2021
ec757bf
use isnothing()
yeesian Apr 25, 2021
d5c1512
whitespacing
yeesian Apr 25, 2021
cf950a2
Array -> Vector
yeesian Apr 25, 2021
2811f95
Introduce enums for WKBByteOrder
yeesian Apr 25, 2021
fca9536
remove pointer definitions in constants.jl
yeesian Apr 25, 2021
cb4a13a
[Breaking] Provide proper support for all GDAL enums
yeesian Apr 25, 2021
2e4cecc
improve test coverage for drivers
yeesian Apr 25, 2021
b782646
Remove unnecessary imports of GDAL in the tests
yeesian Apr 25, 2021
cd4ac78
Add tests for geotransforms
yeesian Apr 25, 2021
1758d84
whitespacing
yeesian Apr 25, 2021
eca39b5
[Breaking] Update implementation of GeoInterface.coordinates()
yeesian Apr 25, 2021
126ced0
LinearRings have the strange property of being treated like linestrings
yeesian Apr 25, 2021
2e168dd
Implement a basetype() method
yeesian Apr 25, 2021
d1d8156
Remove nextnamedtuple() from tables.jl
yeesian Apr 25, 2021
3dc7eb7
Add tests for tables.jl
yeesian Apr 25, 2021
b13e5db
Add tests for rasterio!(...)
yeesian Apr 26, 2021
26cd97a
Add tests for raster/array.jl
yeesian Apr 26, 2021
63c6eb4
[Breaking] Remove untested method for addfielddefn()
yeesian Apr 26, 2021
987fe10
Add tests for displays of different objects
yeesian Apr 26, 2021
1d0b365
Add test for unsafe_getgeom(feature)
yeesian Apr 26, 2021
a4eb87e
Improve test coverage for raster/array.jl
yeesian Apr 26, 2021
4446f22
add tests for tables.jl
yeesian Apr 26, 2021
f93587d
add prefix
yeesian Apr 26, 2021
83bec76
Remove obsolete function
yeesian Apr 26, 2021
340d431
Add support for displaying color tables
yeesian Apr 26, 2021
d557d0a
got missed in the previous commit
yeesian Apr 26, 2021
c8aaeb8
Delete obsolete function
yeesian Apr 26, 2021
8b499d6
Whitespacing
yeesian Apr 26, 2021
8c720e7
Add test for reproject in the case of a no-op
yeesian Apr 26, 2021
3221556
Add test for copywholeraster!
yeesian Apr 26, 2021
d19f53e
Add test for unsafe_getgeom(feature, name)
yeesian Apr 26, 2021
e73d91c
Add test for unsafe_copy(layer)
yeesian Apr 26, 2021
9765462
Add tests for cloning null geometries
yeesian Apr 26, 2021
f5ee120
Update the documentation for working with the tables interface
yeesian Apr 26, 2021
37ad420
Update API reference for geotransfromations
yeesian Apr 26, 2021
c840bb2
Add README for building the documentation
yeesian Apr 26, 2021
f0ecc60
Merge branch 'master' into type-error-messages
yeesian Apr 28, 2021
d7a67df
Fix command for activating the environment
yeesian Apr 28, 2021
dfe9652
Update macro name to reflect its usage and provide a docstring
yeesian May 1, 2021
f9e028c
Add support for images
yeesian May 1, 2021
d3c3ad2
Add the return keyword
yeesian May 1, 2021
1f74057
Add support for YCbCr
yeesian May 1, 2021
979bc60
[Breaking] Delete unneeded ColorTable methods
yeesian May 1, 2021
eca12eb
Add tests for uncovered methods of features
yeesian May 1, 2021
3d00197
Add support for options in toJSON
yeesian May 1, 2021
c3f7d55
Increase test coverage for NULL geometries
yeesian May 1, 2021
b75d0d4
Add support for kwargs in lineargeom
yeesian May 1, 2021
7871cff
[Breaking] Remove initialize!(stylemanager, feature)
yeesian May 1, 2021
21e4772
Use summarize(io, rasterband) for NULL bands
yeesian May 1, 2021
513a98e
remove obsolete comment
yeesian May 1, 2021
2dbd579
Update README.md
yeesian May 1, 2021
2aee418
Add tests for raster attribute tables and color tables
yeesian May 1, 2021
83e1024
Add tests for ColorTable <-> RAT
yeesian May 1, 2021
c5ef729
Add test for cloning raster attribute tables
yeesian May 1, 2021
5da6c4b
Fix flakey test
yeesian May 1, 2021
72ea24c
Add tests for conversion errors
yeesian May 1, 2021
a1339ec
Add test to exercise `macro ogrerr(code, message)`
yeesian May 1, 2021
0b477e1
Add test to exercise `macro cplerr(code, message)`
yeesian May 1, 2021
e8e990c
Add tests for imread
yeesian May 1, 2021
73d12f5
Add tests for axisorder when importing CRS
yeesian May 1, 2021
e4a65aa
Add tests for CRS conversion
yeesian May 1, 2021
d24e781
whitespacing
yeesian May 1, 2021
f0d1ec9
[Breaking] Remove destroy(driver)
yeesian May 1, 2021
7023b39
Replace tabs with spaces
yeesian May 1, 2021
5ba0075
Add tests for images
yeesian May 2, 2021
c49c4bc
Remove untested code for HSL
yeesian May 2, 2021
3a7287a
Test for error cases
yeesian May 2, 2021
58aa862
Add test for gray colortable
yeesian May 2, 2021
4e2a30a
Add test cases for NULL SpatialRefs
yeesian May 2, 2021
5cc0c9a
Add test for color relief
yeesian May 2, 2021
1346154
Add test for conversion error
yeesian May 2, 2021
f47104f
Add test for displaying dataset with many feature layers
yeesian May 2, 2021
221f3f0
Use format from JuliaFormatter
yeesian May 2, 2021
4ac6184
Add github workflow for running JuliaFormatter
yeesian May 2, 2021
582d026
Add format configurations
yeesian May 9, 2021
cc9b1a1
Add a format checker for PRs
yeesian May 9, 2021
befe918
Update the README with the style guide
yeesian May 9, 2021
594976a
Restrict the format checker to just the src/ directory for now.
yeesian May 9, 2021
9debf2f
Update README.md
yeesian May 9, 2021
dbef00a
tweak phrasing
yeesian May 9, 2021
08505ee
Include Julialang in the statement of support
yeesian May 9, 2021
405fb7f
provide a README.md for the tests
yeesian May 10, 2021
f2531ab
Fix the return type
yeesian May 15, 2021
ab775a3
fix format
yeesian May 15, 2021
d3570e0
Tweak README
yeesian May 15, 2021
3d025fe
Add functionality and documentation for raster images
yeesian May 15, 2021
ca1ecc3
Fix file formatting
yeesian May 15, 2021
52af364
Allow to use interactive Datasets in unsafe_gdal functions in utiliti…
felixcremer May 15, 2021
ddc62bf
Replace Pkg.PlatformEngine --> Custom download & verify
zerefwayne May 15, 2021
86ee7ec
Move importing of Downloads and SHA to remotefiles.jl
yeesian May 15, 2021
88a9fa5
Add contributor's guide
yeesian May 15, 2021
130fb4e
Update for geometry type hints in Schema
yeesian May 21, 2021
ebe90bf
Ran JuliaFormatter
yeesian May 21, 2021
c3926c2
Fix tables example
yeesian May 21, 2021
917f792
ArchGDAL.getgeomdefn -> getgeomdefn
yeesian May 21, 2021
a83a33f
add a section about the compat entries
yeesian May 22, 2021
fcaba40
add compat entries for ColorTypes and ImageCore
yeesian May 22, 2021
72d05cc
Merge branch 'type-error-messages' of https://github.com/yeesian/Arch…
yeesian May 22, 2021
6f79b64
Add badges
yeesian May 22, 2021
307f0f2
rearrange badges for color
yeesian May 22, 2021
3a0b3a8
fix for table geometry v.s. field ordering
yeesian May 22, 2021
0ca1a7d
Add conversion for geometries to wkbUnknown
yeesian May 22, 2021
309d598
ran JuliaFormatter
yeesian May 22, 2021
3c94ec2
Revamp implementation of imread() to be on-par with read()
yeesian May 22, 2021
ff3d2eb
Add tests for images
yeesian May 22, 2021
421cac0
Ran JuliaFormatter
yeesian May 22, 2021
1234d6b
remove obsolete code
yeesian May 22, 2021
fb25d5a
Fix the description for updating compatibility
yeesian May 22, 2021
bf6be50
Removing the forecast checker from PRs
yeesian May 30, 2021
ac50e17
Re-enable test for gdal warp
yeesian May 31, 2021
b98940b
Use JuliaFormatter
yeesian May 31, 2021
2a31683
Use links instead of URLs
yeesian May 31, 2021
90b8646
Use `=== nothing` instead of isnothing() for performance
yeesian May 31, 2021
4f7058c
Future-proof the url to use the latest 1.* version.
yeesian May 31, 2021
52ed391
Use the project environment for the docs
yeesian May 31, 2021
e86beac
Format test cases that take up too much vertical whitespace
yeesian May 31, 2021
a665f34
Bugfix to write out the file before reading it.
yeesian May 31, 2021
dadfa12
Remove unnecessary `Table{T<:AbstractFeatureLayer}` type.
yeesian May 31, 2021
a20203a
Merge branch 'master' into type-error-messages
yeesian May 31, 2021
d2ae1bd
Undo replacement of empty geometry column names with "geometry".
yeesian May 31, 2021
37cb501
Tweak wording
yeesian May 31, 2021
4bfaa01
format file
yeesian May 31, 2021
a8f831e
fix typo and use https where possible
yeesian May 31, 2021
5107fe5
use abstract input types and fix indentation for multiline strings
yeesian May 31, 2021
3895551
remove conventions.md
yeesian May 31, 2021
83b7025
Return missing rather than -1 or nothing if no matching field is found.
yeesian May 31, 2021
7351750
Added discussion on tables interface
yeesian May 31, 2021
9c7069c
Add discussion of enum values between base enums and cenums
yeesian May 31, 2021
abe94cd
Updating getnodatavalueband to return missing rather than nothing
yeesian May 31, 2021
e720366
Capture the discussion on colors and images
yeesian May 31, 2021
cff9913
Ran juliaformatter
yeesian May 31, 2021
d5a5885
Add docstrings for enum conversions
yeesian May 31, 2021
ab2b929
annotate return types
yeesian May 31, 2021
38cbd06
Update test-specific dependencies
yeesian May 31, 2021
17301f9
Fix doc builds
yeesian May 31, 2021
bba88d6
ignore tif files
yeesian May 31, 2021
06b2885
Be consistent in using module names as prefixes
yeesian May 31, 2021
1939d11
add GDAL as dependency for docs
yeesian May 31, 2021
29c4a94
Update instructions for formatting code.
yeesian Jun 1, 2021
4faa979
Add details on AbstractDataset potentially having multiple tables
yeesian Jun 5, 2021
2fd5aee
Add a note about (lack of) support for spatialite
yeesian Jun 5, 2021
26a8010
Add an instruction for starting julia
yeesian Jun 5, 2021
b53179d
Add note that tables are only for OGR features and geometries
yeesian Jun 5, 2021
aecd4d8
rewrite if-else to have a single return
yeesian Jun 5, 2021
c615a99
Update show methods to return nothing
yeesian Jun 5, 2021
fa7f005
run JuliaFormatter
yeesian Jun 20, 2021
317272f
Add support for GPI_RGB with GCI_PaletteIndex
yeesian Jun 20, 2021
174e2d6
looser ImageCore and ColorTypes deps (#207)
rafaqz Jun 21, 2021
800bf2c
Switch from `missing` to `nothing`
yeesian Jun 21, 2021
1b40beb
Merge branch 'type-error-messages' of https://github.com/yeesian/Arch…
yeesian Jun 21, 2021
36c5969
Return `nothing` rather than `missing` when no matching field is found
yeesian Jun 21, 2021
eedf3d4
formatting
yeesian Jun 21, 2021
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
8 changes: 8 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Configuration file for JuliaFormatter.jl
# For more information, see: https://domluna.github.io/JuliaFormatter.jl/stable/config/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope we can someday put all these config things into the Project.toml, would clean up nicely.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that'll be nice :)


always_for_in = true
always_use_return = true
margin = 80
remove_extra_newlines = true
short_to_long_function_def = true
31 changes: 31 additions & 0 deletions .github/workflows/format_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: format-check
on:
push:
branches:
- master
- release-*
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: '1'
- uses: actions/checkout@v1
- name: Format check
shell: julia --color=yes {0}
run: |
using Pkg
# If you update the version, also update the style guide docs.
Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.10"))
using JuliaFormatter
format("src", verbose=true)
out = String(read(Cmd(`git diff`)))
if isempty(out)
exit(0)
end
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
30 changes: 30 additions & 0 deletions .github/workflows/format_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: format-pr
yeesian marked this conversation as resolved.
Show resolved Hide resolved
on:
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install JuliaFormatter and format
run: |
julia -e 'import Pkg; Pkg.add("JuliaFormatter")'
julia -e 'using JuliaFormatter; format(".")'

# https://github.com/marketplace/actions/create-pull-request
# https://github.com/peter-evans/create-pull-request#reference-example
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Format .jl files
title: 'Automatic JuliaFormatter.jl run'
branch: auto-juliaformatter-pr
delete-branch: true
labels: formatting, automated pr, no changelog
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ test/gdalworkshop/
test/ospy/
test/pyrasterio/
test/spatialite/
.DS_Store
Manifest.toml
6 changes: 5 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ desc = "A high level API for GDAL - Geospatial Data Abstraction Library"
version = "0.6.0"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DiskArrays = "3c3547ce-8d99-4f5e-a174-61eb10b00ae3"
GDAL = "add2ef01-049f-52c4-9ee2-e494f65e021a"
GeoFormatTypes = "68eda718-8dee-11e9-39e7-89f7f65f511f"
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
yeesian marked this conversation as resolved.
Show resolved Hide resolved
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[compat]
Expand All @@ -23,9 +25,11 @@ julia = "1.3"

[extras]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Dates", "Pkg", "Statistics", "Test"]
test = ["Dates", "Downloads", "Pkg", "Statistics", "SHA", "Test"]
64 changes: 63 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
[![Coverage Status](https://coveralls.io/repos/github/yeesian/ArchGDAL.jl/badge.svg?branch=master)](https://coveralls.io/github/yeesian/ArchGDAL.jl?branch=master)
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://yeesian.com/ArchGDAL.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://yeesian.com/ArchGDAL.jl/dev)
[![ColPrac: Contributor's Guide](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)

[GDAL](http://gdal.org/) is a translator library for raster and vector geospatial data formats that is released under an [X/MIT](https://trac.osgeo.org/gdal/wiki/FAQGeneral#WhatlicensedoesGDALOGRuse) license by the [Open Source Geospatial Foundation](http://www.osgeo.org/). As a library, it presents an abstract data model to drivers for various [raster](http://www.gdal.org/formats_list.html) and [vector](http://www.gdal.org/ogr_formats.html) formats.

This package aims to be a complete solution for working with GDAL in Julia, similar in scope to [the SWIG bindings for Python](https://pypi.python.org/pypi/GDAL/). It builds on top of [GDAL.jl](https://github.com/JuliaGeo/GDAL.jl), and provides a high level API for GDAL, espousing the following principles.
This package aims to be a complete solution for working with GDAL in Julia, similar in scope to [the SWIG bindings for Python](https://pypi.python.org/pypi/GDAL/) and the user-friendliness of [Fiona](https://github.com/Toblerity/Fiona) and [Rasterio](https://github.com/mapbox/rasterio). It builds on top of [GDAL.jl](https://github.com/JuliaGeo/GDAL.jl), and provides a high level API for GDAL, espousing the following principles.

## Principles (The Arch Way)
(adapted from: https://wiki.archlinux.org/index.php/Arch_Linux#Principles)
Expand All @@ -29,3 +30,64 @@ To test if it is installed correctly,
```julia
pkg> test ArchGDAL
```

## Getting Involved

### Community

This package will not be possible without https://julialang.org/, https://github.com/OSGeo/gdal and https://github.com/JuliaGeo/GDAL.jl. They are maintained by https://julialang.org/community/, https://www.osgeo.org/ and https://juliageo.org/. In case of any contention for support and involvement, we encourage participation and contributions to those projects and communities over this package.
yeesian marked this conversation as resolved.
Show resolved Hide resolved

### Style Guide

ArchGDAL.jl uses [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) as
an autoformatting tool, and uses the options in [`.JuliaFormatter.toml`](https://github.com/yeesian/ArchGDAL.jl/blob/master/.JuliaFormatter.toml).

To format code, `cd` to the ArchGDAL.jl directory, then run:
```julia
] add [email protected]
using JuliaFormatter
format("src")
yeesian marked this conversation as resolved.
Show resolved Hide resolved
```

A continuous integration check verifies that all PRs made to ArchGDAL.jl have passed the formatter.

### Dependencies
To manage the dependencies of this package, we work with [environments](https://pkgdocs.julialang.org/v1.6/environments/):
yeesian marked this conversation as resolved.
Show resolved Hide resolved

1. Navigate to the directory corresponding to the package:

```julia
shell> cd /Users/yeesian/.julia/dev/ArchGDAL
/Users/yeesian/.julia/dev/ArchGDAL
```

2. Activate the environment corresponding to `Project.toml`):
yeesian marked this conversation as resolved.
Show resolved Hide resolved

```julia
(@v1.6) pkg> activate .
Activating environment at `~/.julia/environments/v1.6/Project.toml`
```

3. Manage the dependencies using Pkg in https://pkgdocs.julialang.org/v1.6/managing-packages/, e.g.

```julia
(ArchGDAL) pkg> st
Project ArchGDAL v0.6.0
Status `~/.julia/dev/ArchGDAL/Project.toml`
[3c3547ce] DiskArrays
[add2ef01] GDAL
[68eda718] GeoFormatTypes
[cf35fbd7] GeoInterface
[bd369af6] Tables
[ade2ca70] Dates

(ArchGDAL) pkg> add CEnum
Resolving package versions...
Updating `~/.julia/dev/ArchGDAL/Project.toml`
[fa961155] + CEnum v0.4.1
[3c3547ce] + DiskArrays v0.2.7
[add2ef01] + GDAL v1.2.1
[68eda718] + GeoFormatTypes v0.3.0
[cf35fbd7] + GeoInterface v0.5.5
[bd369af6] + Tables v1.4.2
```
yeesian marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ArchGDAL.jl documentation

The latest stable version of the documentation can be viewed at https://yeesian.com/ArchGDAL.jl/stable/. To build a local version of the documentation, navigate to this directory and run the following command:

```shell
$ julia make.jl
yeesian marked this conversation as resolved.
Show resolved Hide resolved
```

It should create files in a subdirectory named `build/`. If it builds successfully, you should be able to preview the documentation in a browser by opening `build/index.html` in a browser.
3 changes: 2 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ makedocs(
"GDAL Datasets" => "datasets.md",
"Feature Data" => "features.md",
"Raster Data" => "rasters.md",
"Working with Images" => "images.md",
"Tables Interface" => "tables.md",
"Geometric Operations" => "geometries.md",
"Spatial Projections" => "projections.md",
Expand All @@ -25,7 +26,7 @@ makedocs(
"Design Considerations" => "considerations.md",
"API Reference" => "reference.md",
# "Naming Conventions" => "conventions.md", # table between GDAL, GDAL.jl, and ArchGDAL.jl
]
],
)

deploydocs(; repo = "github.com/yeesian/ArchGDAL.jl.git")
53 changes: 53 additions & 0 deletions docs/src/images.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Images

```@setup rasters
using ArchGDAL
const AG = ArchGDAL
```

In this section, we revisit the [`gdalworkshop/world.tif`](https://github.com/yeesian/ArchGDALDatasets/blob/307f8f0e584a39a050c042849004e6a2bd674f99/gdalworkshop/world.tif) dataset.
```@example rasters
dataset = AG.read("gdalworkshop/world.tif")
```
A description of the display is available in [Raster Datasets](@ref).

## Reading from Datasets
We can construct an image from it in the following way:
```@example rasters
AG.imread(dataset)
```

## Reading from Files
We can read the file as an image instead:
```@example rasters
AG.imread("gdalworkshop/world.tif")
```

## Reading from Rasterbands
We can also read from individual raster bands:
```@example rasters
AG.imread(AG.getband(dataset, 1))
```
Or equivalently,
```@example rasters
AG.imread(dataset, 1)
```
It will interpret the color channel (for RGB) correctly there is one. E.g.
yeesian marked this conversation as resolved.
Show resolved Hide resolved
```@example rasters
AG.imread(dataset, 2)
```
and
```@example rasters
AG.imread(dataset, 3)
```

## Working with Colors
Operations on colors behave as you think they might:
```@example rasters
AG.imread(dataset, 2) + AG.imread(dataset, 3)
```
and
```@example rasters
0.5 * AG.imread(dataset, 1) + AG.imread(dataset, 3)
```
See [Colors.jl](http://juliagraphics.github.io/Colors.jl/stable/) for more on what you can do.
yeesian marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 5 additions & 5 deletions docs/src/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ end
under the hood (see `src/context.jl`). Therefore, the objects themselves do not have a finalizer registered:
```julia
mutable struct RasterBand <: AbstractRasterBand
ptr::GDALRasterBand
ptr::GDAL.GDALRasterBandH
end

unsafe_getband(dataset::AbstractDataset, i::Integer) =
RasterBand(GDAL.getrasterband(dataset.ptr, i))

function destroy(rb::AbstractRasterBand)
rb.ptr = GDALRasterBand(C_NULL)
rb.ptr = C_NULL
end
```

Expand All @@ -65,11 +65,11 @@ rasterband = ArchGDAL.getband(dataset, i)
returns an interactive rasterband that has `destroy()` registered with its finalizer.
```julia
mutable struct IRasterBand <: AbstractRasterBand
ptr::GDALRasterBand
ptr::GDAL.GDALRasterBandH
ownedby::AbstractDataset

function IRasterBand(
ptr::GDALRasterBand = GDALRasterBand(C_NULL);
ptr::GDAL.GDALRasterBandH = C_NULL;
ownedby::AbstractDataset = Dataset()
)
rasterband = new(ptr, ownedby)
Expand All @@ -82,7 +82,7 @@ getband(dataset::AbstractDataset, i::Integer) =
IRasterBand(GDAL.getrasterband(dataset.ptr, i), ownedby = dataset)

function destroy(rasterband::IRasterBand)
rasterband.ptr = GDALRasterBand(C_NULL)
rasterband.ptr = C_NULL
rasterband.ownedby = Dataset()
return rasterband
end
Expand Down
11 changes: 9 additions & 2 deletions docs/src/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```@autodocs
Modules = [ArchGDAL]
Pages = ["ArchGDAL.jl", "display.jl", "iterators.jl", "gcp.jl", "types.jl", "utils.jl"]
Pages = ["ArchGDAL.jl", "display.jl", "iterators.jl", "types.jl", "utils.jl"]
```

## [GDAL Datasets](@id API-GDAL-Datasets)
Expand Down Expand Up @@ -34,13 +34,20 @@ Modules = [ArchGDAL]
Pages = ["array.jl", "colortable.jl", "rasterattributetable.jl", "rasterband.jl", "rasterio.jl"]
```

## [Spatial projections](@id API-Spatial-projections)
## [Spatial Projections](@id API-Spatial-Projections)

```@autodocs
Modules = [ArchGDAL]
Pages = ["spatialref.jl"]
```

## [Geo Transformations](@id API-GeoTransforms)

```@autodocs
Modules = [ArchGDAL]
Pages = ["geotransform.jl"]
```

## [Utilities](@id API-Utilities)

```@autodocs
Expand Down
33 changes: 2 additions & 31 deletions docs/src/tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,7 @@ The [`ArchGDAL.Table`](@ref) method accepts an `ArchGDAL.FeatureLayer`.
table = ArchGDAL.Table(layer)
```

Individual rows can be retrieved using the `Base.getindex(t::ArchGDAL.Table, idx::Int)` method or simply `table[idx]`.

```@example tables
row = table[1]
```

Layers are retrievable!
One can get back the layer that a Table is made up of.
```@example tables
lyr = ArchGDAL.getlayer(table)
```

The Tables interface also support multiple geometries per layer.

Here, we visit the
Finally layers can be converted to DataFrames to perform miscellaneous spatial operations. Here, we visit the
[`data/multi_geom.csv`](https://github.com/yeesian/ArchGDALDatasets/blob/master/data/multi_geom.csv)
dataset.

Expand All @@ -51,22 +37,7 @@ dataset1 = ArchGDAL.read("data/multi_geom.csv", options = ["GEOM_POSSIBLE_NAMES=

layer = ArchGDAL.getlayer(dataset, 0)
table = ArchGDAL.Table(layer)
```

Exatracting a row from the table, we see that the row/feature is made up of two geometries
viz. `point` and `linestring`.
```@example tables
row = table[1]
```

Finally layers can be converted to DataFrames to perform miscellaneous spatial operations.
```@example tables
df = DataFrame(table)
```
In some cases the `nextfeature` might become a bit tedious to use. In which case the `ArchGDAL.nextnamedtuple()` method comes in handy. Though built upon `nextfeature`, simply calling it, yields the `feature` as a `NamedTuple`. Though one might have to use `ArchGDAL.resetreading!(layer)` method to reset the layer reading to the start.

```@example tables
ArchGDAL.resetreading!(layer)
feat1 = ArchGDAL.nextnamedtuple(layer)
feat2 = ArchGDAL.nextnamedtuple(layer)
```
The Tables interface also supports multiple geometries per layer.
Loading