mirror of
https://0xacab.org/radar/radar-wp.git
synced 2024-12-25 01:56:28 +01:00
28 lines
534 B
PHP
28 lines
534 B
PHP
|
<?php
|
||
|
/**
|
||
|
* EWKT (Extended Well Known Text) Adapter
|
||
|
*/
|
||
|
class EWKT extends WKT
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* Serialize geometries into an EWKT string.
|
||
|
*
|
||
|
* @param Geometry $geometry
|
||
|
*
|
||
|
* @return string The Extended-WKT string representation of the input geometries
|
||
|
*/
|
||
|
public function write(Geometry $geometry) {
|
||
|
$srid = $geometry->SRID();
|
||
|
$wkt = '';
|
||
|
if ($srid) {
|
||
|
$wkt = 'SRID=' . $srid . ';';
|
||
|
$wkt .= $geometry->out('wkt');
|
||
|
return $wkt;
|
||
|
}
|
||
|
else {
|
||
|
return $geometry->out('wkt');
|
||
|
}
|
||
|
}
|
||
|
}
|