定制 ffogarasi/kmz-parser 二次开发

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

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

ffogarasi/kmz-parser

最新稳定版本:1.1.2

Composer 安装命令:

composer require ffogarasi/kmz-parser

包简介

Turn KML file into objects

README 文档

README

Latest Stable Version License

The most intuitive KML parser. Each part of the file is represented by a special class, so everything you need is accessible via predictable and hinted methods.

Installation

Using composer:

composer require ffogarasi/kmz-parser

Usage

A simple example, how to use the parser:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" id="test">
  <Document>
    <name>Document name</name>
    <description>Description</description>
    <Style id="icon-1899-0288D1-normal">
      # ...
    </Style>
    <Style id="icon-1899-0288D1-highlight">
      # ...
    </Style>
    <StyleMap id="icon-1899-0288D1">
      # ...
    </StyleMap>
    <Folder>
      <name>Unnamed layer</name>
      # ...
    </Folder>
  </Document>
</kml>
use StepanDalecky\KmlParser\Parser;

$parser = Parser::fromFile('file.xml');
// $parser = Parser::fromString($xmlString);

$kml = $parser->getKml();
$document = $kml->getDocument();

$styles = $document->getStyles();
echo $styles[0]->getId(); // icon-1899-0288D1-normal

$folders = $document->getFolders();
echo $folders[0]->getName(); // Unnamed layer

For more examples see the tests.

Unsupported KML Elements?

Custom development of this library is not planned anymore. There are two ways to deal with elements that have not been covered yet:

  1. Fork this library, add elements you need and create a merge request back to this library.
  2. Use emergency method Entity::getElement().

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-08