定制 karomap/php-ogc 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

karomap/php-ogc

Composer 安装命令:

composer require karomap/php-ogc

包简介

GeoSpatial objects (Open Geo Consortium compliant)

README 文档

README

Latest Version on Packagist Total Downloads CircleCI

Rationale

This is a fork from elevenlab/php-ogc with some modifications.
This package aims to implement the Open Geo Consortium proposed standard for geo-spatial objects.

Installation

Using Composer

Execute in the project root folder:

$ composer require karomap/php-ogc

Manually

TODO

API Documentation

https://karomap.github.io/php-ogc/

Quick Documentation

All objects could be created from and exported as:

  • Well Known Text (WKT) format
  • Well Known Binary (WKB) format

Point

<?php

$p1 = new Point(1.234, 2.345);
$p2 = new Point("1.234", "2.345");
$p3 = Point::fromArray([1.234, 2.345]);
$p4 = Point::fromString("1.234, 2.345");
$p5 = Point::fromString("1.234 2.345", " ");
$p6 = Point::fromString("1.234#2.345", "#");
$p7 = Point::fromWKT("POINT(0 0)");

// Specify SRID
$p1 = new Point(1.234, 2.345, 4326);
$p2 = new Point("1.234", "2.345", 4326);

LineString

<?php

$l1 = new LineString([new Point(1, 2), new Point(3, 4), new Point(5, 6)]);
$l2 = new LineString([new Point(1, 2), new Point(3, 4), new Point(5, 6), new Point(1, 2)]);
$l3 = LineString::fromArray([[1,2], [2,3], [3,4]]);
$l4 = LineString::fromString('1 2, 2 3, 3 4, 4 5');
$l5 = LineString::fromString('1 2@ 2 3@ 3 4@ 4 5', '@');
$l6 = LineString::fromString('1#2@2#3@3#4@4#5', '@', '#');
$l7 = LineString::fromWKT("LINESTRING(0 0,1 1,1 2)");

MultiPoint

Identical to LineString.

MultiLineString

<?php

$ml1 = new MultiLineString([LineString::fromArray([[1,2], [2,3], [3,4]]), LineString::fromArray([[5,6], [7,8], [9,10]])]);
$ml2 = MultiLineString::fromArray([[[1,2], [2,3], [3,4]],[[5,6], [7,8], [9,10]]]);
$ml3 = MultiLineString::fromString("1 2, 2 3, 3 4; 5 6, 7 8, 9 10");
$ml4 = MultiLineString::fromString("1 2, 2 3, 3 4@ 5 6, 7 8, 9 10", "@");
$ml4 = MultiLineString::fromString("1 2, 2 3, 3 4@ 5 6, 7 8, 9 10", "@");
$ml5 = MultiLineString::fromString("1 2# 2 3# 3 4@ 5 6# 7 8# 9 10", "@", "#");
$ml6 = MultiLineString::fromString("1^2#2^3# 3^4@ 5^6# 7^8# 9^10", "@", "#", "^");
$ml7 = MultiLineString::fromWKT("MULTILINESTRING((0 0,4 0,4 4,0 4),(1 1, 2 1, 2 2, 1 2))");

Polygon

The only difference between Polygon and MultiLineString objects is that the former must be composed by all circular linestrings (first and last point equals).

MultiPolygon

<?php

$mp1 = new MultiPolygon([
    new Polygon([LineString::fromArray([[1,2], [2,3], [3,4], [1,2]]), LineString::fromArray([[5,6], [7,8], [9,10], [5,6]])]),
    new Polygon([LineString::fromArray([[1,2], [2,3], [3,4], [1,2]]), LineString::fromArray([[5,6], [7,8], [9,10], [5,6]])]),
    new Polygon([LineString::fromArray([[1,2], [2,3], [3,4], [1,2]]), LineString::fromArray([[5,6], [7,8], [9,10], [5,6]])])
]);
$mp2 = MultiPolygon::fromArray([
    [[[1,2], [2,3], [3,4], [1,2]],[[5,6], [7,8], [9,10], [5,6]]],
    [[[1,2], [2,3], [3,4], [1,2]],[[5,6], [7,8], [9,10], [5,6]]],
    [[[1,2], [2,3], [3,4], [1,2]],[[5,6], [7,8], [9,10], [5,6]]]
]);
$mp3 = MultiPolygon::fromString("1 2, 2 3, 3 4, 1 2; 5 6, 7 8, 9 10, 5 6|1 2, 2 3, 3 4, 1 2; 5 6, 7 8, 9 10, 5 6|1 2, 2 3, 3 4, 1 2; 5 6, 7 8, 9 10, 5 6");
$mp4 = MultiPolygon::fromString("1 2, 2 3, 3 4, 1 2; 5 6, 7 8, 9 10, 5 6%1 2, 2 3, 3 4, 1 2; 5 6, 7 8, 9 10, 5 6%1 2, 2 3, 3 4, 1 2; 5 6, 7 8, 9 10, 5 6", "%");
$mp5 = MultiPolygon::fromString("1 2, 2 3, 3 4, 1 2# 5 6, 7 8, 9 10, 5 6%1 2, 2 3, 3 4, 1 2# 5 6, 7 8, 9 10, 5 6%1 2, 2 3, 3 4, 1 2# 5 6, 7 8, 9 10, 5 6", "%", "#");
$mp6 = MultiPolygon::fromString("1 2: 2 3: 3 4: 1 2# 5 6: 7 8: 9 10: 5 6%1 2: 2 3: 3 4: 1 2# 5 6: 7 8: 9 10: 5 6%1 2: 2 3: 3 4: 1 2# 5 6: 7 8: 9 10: 5 6", "%", "#", ":");
$mp7 = MultiPolygon::fromString("1?2: 2?3: 3?4: 1?2# 5?6: 7?8: 9?10: 5?6%1?2: 2?3: 3?4: 1?2# 5?6: 7?8: 9?10: 5?6%1?2: 2?3: 3?4: 1?2# 5?6: 7?8: 9?10: 5?6", "%", "#", ":", "?");
$mp8 = MultiPolygon::fromWKT("MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)),((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1)))");

GeometryCollection

<?php

$gc = new GeometryCollection([
    new Polygon([LineString::fromArray([[1,2], [2,3], [3,4], [1,2]]), LineString::fromArray([[5,6], [7,8], [9,10], [5,6]])]),
    MultiPolygon::fromString("1 2, 2 3, 3 4, 1 2; 5 6, 7 8, 9 10, 5 6|1 2, 2 3, 3 4, 1 2; 5 6, 7 8, 9 10, 5 6|1 2, 2 3, 3 4, 1 2; 5 6, 7 8, 9 10, 5 6"),
    MultiLineString::fromArray([[[1,2], [2,3], [3,4]],[[5,6], [7,8], [9,10]]]),
    LineString::fromWKT("LINESTRING(0 0,1 1,1 2)"),
    new Point(1.234, 2.345)
]);

ToDo

  • add docs for manual installation
  • add constructor

karomap/php-ogc 适用场景与选型建议

karomap/php-ogc 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 166 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 09 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「geo」 「geospatial」 「ogc」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 karomap/php-ogc 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 karomap/php-ogc 我们能提供哪些服务?
定制开发 / 二次开发

基于 karomap/php-ogc 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 166
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 13
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-only
  • 更新时间: 2018-09-02