Skip to content

Commit

Permalink
Merge 6b91128 into e057132
Browse files Browse the repository at this point in the history
  • Loading branch information
djlambert committed May 22, 2016
2 parents e057132 + 6b91128 commit 8036d63
Show file tree
Hide file tree
Showing 9 changed files with 1,275 additions and 457 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -9,10 +9,14 @@ php:
- hhvm

before_script:
- composer self-update
- composer --prefer-source install

script:
- ./vendor/bin/phpunit -v --coverage-clover ./build/logs/clover.xml

after_script:
- ./vendor/bin/test-reporter --coverage-report ./build/logs/clover.xml

after_success:
- ./vendor/bin/coveralls -v --exclude-no-stmt
29 changes: 29 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,13 +4,41 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added

### Changed

### Removed

## [2.3.0] - 2016-05-22
### Added
- Tests for empty geometry objects.
- getCurrentPosition() and getLastPosition methods in Reader to get position in byte stream.
- Support for OCG 1.2 encoding of 3D and 4D geometry.
- Method getBadTypeInTypeMessage() in Parser to generate helpful and descriptive exception message.
- Badge and configuration for Coveralls.

### Changed
- NaN coordinates are not returned in point value array, empty point value now array().
- Reader::readDouble() now deprecated and calls Reader::readFloat().
- Reader::readDoubles() now deprecated and calls Reader::readFloats().
- unpack() errors are now caught in unpackInput() and a library exception thrown.
- Inner types (points in multipoint, etc.) are now checked for same dimensions of parent object.
- The search for 'x' in hex values beginning with 'x' or '0x' is now case-insensitive.
- Supported encoding and input formats added to documentation.
- References for encodings added to documentation.
- Lots of additional test data and cases, and cleanup.
- Library exceptions now caught in readGeometry() and rethrown appending Reader position in message.
- All thrown exceptions now have a message.
- Now a single return for all code paths in Parser::getMachineByteOrder().
- Tweaked tests and code for 100% coverage.
- Updated travis config for coveralls.

## [2.2.0] - 2016-05-03
### Added
- Added Tests namespace to Composer PSR-0 dev autoload.
- Added 'dimension' key to returned array containing object dimensions (Z, M, or ZM).
- Reader::getMachineByteOrder method to detect running platform endianness.

### Changed
- Parser property with Reader instance no longer static.
- Replaced sprintf function call in Reader::unpackInput() with string concatenation.
Expand All @@ -19,6 +47,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Updated documentation with new usage pattern.
- Type name in returned array now contains only base type without dimensions (Z, M, and ZM).
- Reader::readDouble() now checks running platform endianness before byte-swapping values instead of assuming little-endian.

### Removed
- Removed now unused TestInit

Expand Down
33 changes: 29 additions & 4 deletions README.md
Expand Up @@ -3,8 +3,9 @@
[![Build Status](https://travis-ci.org/creof/wkb-parser.svg?branch=master)](https://travis-ci.org/creof/wkb-parser)
[![Code Climate](https://codeclimate.com/github/creof/wkb-parser/badges/gpa.svg)](https://codeclimate.com/github/creof/wkb-parser)
[![Test Coverage](https://codeclimate.com/github/creof/wkb-parser/badges/coverage.svg)](https://codeclimate.com/github/creof/wkb-parser/coverage)
[![Coverage Status](https://coveralls.io/repos/github/creof/wkb-parser/badge.svg?branch=master)](https://coveralls.io/github/creof/wkb-parser?branch=master)

Parser library for 2D, 3D, and 4D WKB/EWKB spatial object data.
Parser library for 2D, 3D, and 4D Open Geospatial Consortium (OGC) WKB or PostGIS EWKB spatial object data.

## Usage

Expand All @@ -26,14 +27,38 @@ $value1 = $parser->parse($input1);
$value2 = $parser->parse($input2);
```

### Input value

#### Encoding

The parser currently supports 3 WKB encodings:

- OGC v1.1
- OGC v1.2
- PostGIS EWKB

#### Format

The parser supports a number of input formats:

- Binary string (as returned from database or ```pack('H*', $hexString)```)
- Bare hexadecimal text string (```'01010000003D0AD7A3.....'```)
- Hexadecimal test string prepended with ```x```, ```X```, ```0x```, or ```0X``` (```'0x01010000003D0AD7A3.....'```, etc.)

## Return

The parser will return an array with the keys ```type```, ```value```, ```srid```, and ```dimension```.
- ```type``` string, the spatial object type (POINT, LINESTRING, etc.) without any dimension.
- ```value``` array, contains integer or float values for points, or nested arrays containing these based on spatial object type.
- ```srid``` integer, the SRID if EWKT value was parsed, ```null``` otherwise.
- ```type``` string, the uppercase spatial object type (```POINT```, ```LINESTRING```, etc.) without any dimension.
- ```value``` array, contains integer or float values for points, nested arrays containing these based on spatial object type, or empty array for EMPTY geometry.
- ```srid``` integer, the SRID if present in EWKB value, ```null``` otherwise.
- ```dimension``` string, will contain ```Z```, ```M```, or ```ZM``` for the respective 3D and 4D objects, ```null``` otherwise.

## Exceptions

The ```Reader``` and ```Parser``` will throw exceptions implementing interface ```CrEOF\Geo\WKB\Exception\ExceptionInterface```.

## References
- PostGIS EWKB - https://github.com/postgis/postgis/blob/svn-trunk/doc/ZMSgeoms.txt
- OGC Simple Feature Access, Part 1 - http://www.opengeospatial.org/standards/sfa
- OGC Simple Feature Access, Part 2 - http://www.opengeospatial.org/standards/sfs

3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -16,7 +16,8 @@
},
"require-dev": {
"phpunit/phpunit": ">=4.8",
"codeclimate/php-test-reporter": "dev-master"
"codeclimate/php-test-reporter": "dev-master",
"satooshi/php-coveralls": "~1.0"
},
"autoload": {
"psr-0": {
Expand Down

0 comments on commit 8036d63

Please sign in to comment.