Skip to content

Commit 8d9dbea

Browse files
Felix Davvertix
authored andcommitted
Extend documentation for easier contribution (#12)
* Split up documentation from readme into docs folder * Extend contributing information * Add copyright statement
1 parent 98beebf commit 8d9dbea

72 files changed

Lines changed: 1480 additions & 152 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CLA.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Contributor License Agreement
2+
3+
If you are an employee and have created the contribution as part of your employment,
4+
you need to have your employer approve this agreement.
5+
If you do not own the copyright in the entire work of authorship,
6+
any other author of the contribution also needs to sign this.
7+
8+
## Copyright License
9+
10+
You hereby grant to Oneoff-tech UG, the maintainer of GeoServer PHP Client,
11+
a worldwide, royalty-free, non-exclusive, perpetual and irrevocable license,
12+
with the right to transfer an unlimited number of non-exclusive licenses
13+
or to grant sublicenses to third parties, under the copyright covering the contribution
14+
to use the contribution by all means, including, but not limited to:
15+
16+
* publish the contribution,
17+
* modify the contribution,
18+
* prepare derivative works based upon or containing the contribution
19+
and/or to combine the contribution with other materials,
20+
* reproduce the contribution in original or modified form,
21+
* distribute, to make the contribution available to the public, display
22+
and publicly perform the contribution in original or modified form.
23+
24+
## Free Software Pledge
25+
26+
We agree to irrevocably (sub)license the contribution
27+
or any materials containing, based on or derived from your contribution
28+
under the terms of any licenses
29+
the Free Software Foundation classifies as [Free Software licenses](https://www.gnu.org/licenses/license-list.html)
30+
and which are approved by the Open Source Initiative as [Open Source licenses](http://opensource.org/licenses).
31+
See the [LICENSE](/LICENSE.txt) file, for the current license used.

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# How to contribute to GeoServer PHP Client
2+
3+
This library is Free and Open Source Software. All Contributions to this project are most welcome, and can take many forms such as detailed bug reports, documentation, tests, features, and patches. Note that all contributions are managed by [OneOffTech](https://www.oneofftech.xyz).
4+
5+
## Bugs and Help
6+
7+
GitHub [issues should only be created](https://github.com/OneOffTech/geoserver-client-php/issues/new) to log bugs or ask for help. Before posting to Github, please also search the existing issues to see if the bug has already been reported, and add any further details to the existing issue.
8+
9+
## Development
10+
11+
Contributions are most easily managed via GitHub [pull requests](https://github.com/oneofftech/geoserver-client-php/pulls). To prepare one, [fork the GeoServer PHP Client](https://github.com/oneofftech/geoserver-client-php/fork) into your own GitHub repository. Then you'll be able to commit your work and submit pull requests. Once you are done, Github allows you to create a pull request and propose your changes to the original repository. Make sure you target your pull request to the `master` branch.
12+
13+
The project follows the PSR-2 coding standard. Please run `./vendor/bin/php-cs-fixer fix` before wrapping everything up.
14+
15+
## Documentation
16+
17+
All documentation is stored in the ["docs" directory of this repository](https://github.com/OneOffTech/geoserver-client-php/tree/master/docs). Any contribution on improving the documentation is highly appreciated and a good way to become a welcomed contributor.
18+
19+
## Contributor License Agreement
20+
21+
The [Contributor License Agreement](./CLA.md) specifies the way how copyright of your contribution is handled. Please include in the comment on your pull request a statement like the following:
22+
23+
> I'd like to contribute `feature X|bugfix Y|docs|something else` to GeoServer PHP Client. I confirm that my contributions to GeoServer PHP Client will be compatible with the GeoServer PHP Client Contributor License Agreement at the time of contribution.

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[![Build Status](https://travis-ci.org/OneOffTech/geoserver-client-php.svg?branch=master)](https://travis-ci.org/OneOffTech/geoserver-client-php)
2+
![Packagist](https://img.shields.io/packagist/v/oneofftech/geoserver-client-php.svg)
3+
4+
# GeoServer PHP Client
5+
6+
This PHP library provides programmatic functions to access a [GeoServer](http://geoserver.org/).
7+
8+
It is Free and Open Source Software. All contributions are most welcome. Learn more about [how to contribute](./CONTRIBUTING.md).
9+
10+
#### Features
11+
12+
* Obtain the [version](./docs/usage.md#get-the-geoserver-version) of the connected GeoServer instance
13+
* [Create workspace](./docs/usage.md#create-the-workspace) or retrieve existing workspace details
14+
* [Create datastores](./docs/usage.md#data-stores) and listing them
15+
* [Create coveragestores](./docs/usage.md#coverage-stores) and listing them
16+
* [Upload files](./docs/usage.md#uploading-geographic-files) in various [formats](#supported-file-formats)
17+
* [Manage styles](./docs/usage.md#styles) in SLD format
18+
19+
For detailed information of each of the provided functions check out the [documentation on the usage](./docs/usage.md).
20+
21+
#### Requirements
22+
23+
* [PHP 7.1](http://www.php.net/) or above.
24+
* [GeoServer](http://geoserver.org/) 2.13.0 or above
25+
26+
## Installation
27+
28+
The GeoServer PHP Client uses [Composer](http://getcomposer.org/) to manage its dependencies.
29+
30+
```bash
31+
composer require php-http/guzzle6-adapter guzzlehttp/psr7 oneofftech/geoserver-client-php
32+
```
33+
34+
For more information, please review the [documentation on the installation process](./docs/installation.md).
35+
36+
## Supported file formats
37+
38+
The library handles:
39+
40+
* `Shapefile`
41+
* `Shapefile` inside `zip` archive
42+
* `GeoTIFF`
43+
* `GeoPackage` format version 1.2 (can contain both vector and raster data, but will be reported as vector)
44+
* Styled Layer Descriptor `SLD` files for layer styles in XML format
45+
46+
Read more on [supported file formats and encoding](./docs/supported-files.md).
47+
48+
## License
49+
50+
This project is Free and Open Source Software, licensed under the [AGPL v3 license](./LICENSE.txt).

docs/installation.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Installation
2+
3+
The GeoServer client uses [Composer](http://getcomposer.org/) to manage its dependencies.
4+
5+
```bash
6+
composer require php-http/guzzle6-adapter guzzlehttp/psr7 oneofftech/geoserver-client-php
7+
```
8+
9+
The GeoServer client is not hard coupled to [Guzzle](https://github.com/guzzle/guzzle) or any other library that sends HTTP messages. It uses an abstraction called [HTTPlug](http://httplug.io/). This will give you the flexibilty to choose what PSR-7 implementation and HTTP client to use.
10+
11+
## Why requiring so many packages?
12+
13+
GeoServer client has a dependency on the virtual package
14+
[php-http/client-implementation](https://packagist.org/providers/php-http/client-implementation) which requires to you install **an** adapter, but we do not care which one. That is an implementation detail in your application. We also need **a** PSR-7 implementation and **a** message factory.
15+
16+
You do not have to use the `php-http/guzzle6-adapter` if you do not want to. You may use the `php-http/curl-client`. Read more about the virtual packages, why this is a good idea and about the flexibility it brings at the [HTTPlug docs](http://docs.php-http.org/en/latest/httplug/users.html).

docs/supported-files.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Supported file formats
2+
3+
The library is able to recognize:
4+
5+
* `Shapefile`
6+
* `Shapefile` inside `zip` archive
7+
* `GeoTIFF`
8+
* `GeoPackage` format version 1.2 (can contain both vector and raster data, but will be reported as vector)
9+
* Styled Layer Descriptor `SLD` files for layer styles in XML format
10+
11+
You can check if a file is supported using
12+
13+
```php
14+
use OneOffTech\GeoServer\GeoFile;
15+
use OneOffTech\GeoServer\StyleFile;
16+
17+
$isSupported = GeoFile::isSupported($path);
18+
// => true/false
19+
20+
21+
// For style files, the support is available with the StyleFile class
22+
$isSupported = StyleFile::isSupported($path);
23+
// => true/false
24+
```
25+
26+
> The library supports only the file formats that can be uploaded to a GeoServer.
27+
> For example `Geojson`, `KML` and `GPX` are not supported out-of-the-box by GeoServer,
28+
> although plugins might be available for doing that
29+
30+
# File Character Encoding
31+
32+
GeoServer can deal with character encoding of layers/features, but tests highlighted
33+
a limited support when using UTF-8 for data/coverage store names.
34+
35+
To prevent issues with UTF-8 features attributes, the client set the character encoding
36+
to UTF-8 when uploading a file. In this way GeoServer will consider UTF-8 as the
37+
character encoding for features/attributes contained in the file. This do not affect
38+
layer or store names.
39+
40+
As by design decision the store name is the filename, or the assigned name when
41+
performing the upload, we highly reccomend to use ASCII characters for it.
42+
Use of UTF-8 encoded filenames (or store name) might prevent the client to retrieve the
43+
store/layer corresponding to the uploaded file.

docs/tests.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Testing
2+
3+
The library is covered with unit and integration tests.
4+
5+
```
6+
vendor/bin/phpunit
7+
```
8+
9+
By default integration tests are not executed unless in the phpunit.xml file a GeoServer instance is specified.
10+
11+
The `phpunit.xml.dist` define the `GEOSERVER_URL`, `GEOSERVER_USER`, `GEOSERVER_PASSWORD` for that purpose.
12+
If you want you can copy `phpunit.xml.dist` to `phpunit.xml` and edit those variables in place
13+
or define them in your environment variables.
14+
15+
```xml
16+
<env name="GEOSERVER_URL" value="http://localhost:8600/geoserver/"/>
17+
<env name="GEOSERVER_USER" value="user"/>
18+
<env name="GEOSERVER_PASSWORD" value="pass"/>
19+
```
20+
21+
If you don't have a GeoServer instance to trash there is a `docker-compose.yml` file that, with
22+
the help of Docker and the [kartoza/geoserver image](https://hub.docker.com/r/kartoza/geoserver/),
23+
creates a running GeoServer instance on port 8600.
24+
25+
> Be aware that the Kartoza GeoServer image requires [4GB of RAM](https://github.com/kartoza/docker-geoserver/blob/master/Dockerfile#L23-L25) to run
26+
27+
```bash
28+
docker-compose -f ./tests/docker-compose.yml up -d
29+
# here better to wait for the full startup of the geoserver
30+
vendor/bin/phpunit
31+
```
32+
33+
**Notes on testing files**
34+
35+
- The GeoPackage testing file was copied from [github.com/ngageoint/geopackage-js](https://github.com/ngageoint/geopackage-js/blob/master/test/fixtures/rivers.gpkg)

0 commit comments

Comments
 (0)