stepandalecky/kml-parser
最新稳定版本:v0.2.2
Composer 安装命令:
composer require stepandalecky/kml-parser
包简介
Turn KML file into objects
README 文档
README
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 stepandalecky/kml-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:
- Fork this library, add elements you need and create a merge request back to this library.
- Use emergency method
Entity::getElement().
统计信息
- 总下载量: 29.24k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-16