creof/geo-parser
Composer 安装命令:
composer require creof/geo-parser
包简介
Parser for geography coordinate strings
README 文档
README
Lexer and parser library for geometric and geographic point string values.
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:
$input = '79°56′55″W, 40°26′46″N'; $parser = new Parser($input); $value = $parser->parse();
If many values need to be parsed, a single Parser instance can be used:
$input1 = '56.242 E'; $input2 = '40:26:46 S'; $parser = new Parser(); $value1 = $parser->parse($input1); $value2 = $parser->parse($input2);
Supported Formats
Both single values and pairs are supported. Some samples of supported formats are below, though not every possible iteration may be explicitly specified:
- Simple single signed values
- 40
- -40
- -8.543
- +132
- +77.2
- Simple single signed values with degree symbol
- 40°
- -40°
- -5.234°
- +43°
- +38.43°
- Single unsigned values with or without degree symbol, and cardinal direction
- 40° N
- 40 S
- 56.242 E
- Single values of signed integer degrees with degree symbol, and decimal minutes with apostrophe
- 40° 26.222'
- -65° 32.22'
- +165° 52.22'
- Single values of unsigned integer degrees with degree symbol, decimal minutes with apostrophe, and cardinal direction
- 40° 26.222' E
- 65° 32.22' S
- Single values of signed integer degrees with degree symbol, integer minutes with apostrophe, and optional integer or decimal seconds with quote
- 40° 26' 46"
- -79° 58' 56"
- 93° 19' 25.8"
- +120° 19' 25.8"
- Single values of signed integer degrees with colon symbol, integer minutes, and optional colon and integer or decimal seconds
- +40:26:46
- -79:58:56
- 93:19:25.8
- Single values of unsigned integer degrees with degree symbol, integer minutes with apostrophe, optional integer or decimal seconds with quote, and cardinal direction
- 40° 26' 46" S
- 99° 58' 56" W
- 44° 58' 53.9" N
- Single values of unsigned integer degrees with colon symbol, integer minutes with, optional colon and integer or decimal seconds, and cardinal direction
- 40:26:46 S
- 99:58:56 W
- 44:58:53.9 N
-
Two of any one format separated by whitespace
-
Two of any one format separated by a comma
Return
The parser will return a integer/float or an array containing a pair of these values.
Exceptions
The Lexer and Parser will throw exceptions implementing interface CrEOF\Geo\String\Exception\ExceptionInterface.
creof/geo-parser 适用场景与选型建议
creof/geo-parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.58M 次下载、GitHub Stars 达 61, 最近一次更新时间为 2014 年 03 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「geo」 「geometry」 「text」 「parser」 「geography」 「string」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 creof/geo-parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 creof/geo-parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 creof/geo-parser 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Show geo marker on a mapbox map
Show geo shape on a mapbox map with drawing capabilities
Common libraries used by Zimbra Api
Geo-related tools PHP 7.3+ library
PHP Countries and Currencies
统计信息
- 总下载量: 4.58M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 62
- 点击次数: 28
- 依赖项目数: 16
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-03-22