creof/wkb-parser 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

creof/wkb-parser

最新稳定版本:v2.4

Composer 安装命令:

composer require creof/wkb-parser

包简介

Parser for well-known binary (WKB/EWKB) object data

README 文档

README

Build Status Code Climate Test Coverage Coverage Status

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

Usage

There are two use patterns for the parser. The value to be parsed can be passed into the constructor, then parse() called on the returned Parser object:

$parser = new Parser($input);

$value = $parser->parse();

If many values need to be parsed, a single Parser instance can be used:

$parser = new Parser();

$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 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

统计信息

  • 总下载量: 4.91M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 60
  • 点击次数: 1
  • 依赖项目数: 19
  • 推荐数: 0

GitHub 信息

  • Stars: 60
  • Watchers: 3
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04