43 lines
876 B
PHP
43 lines
876 B
PHP
|
<?php
|
||
|
class GeoMetaData
|
||
|
{
|
||
|
//GeoMetaData GeoJSON class
|
||
|
var $type="FeatureCollection";
|
||
|
var $features;
|
||
|
public function addFeature($geo)
|
||
|
{
|
||
|
$this->features[]=$geo;
|
||
|
}
|
||
|
}
|
||
|
class Geometry
|
||
|
{
|
||
|
var $type;
|
||
|
var $coordinates;
|
||
|
}
|
||
|
class Geofeature
|
||
|
{
|
||
|
var $type="Feature";
|
||
|
var $id;
|
||
|
var $geometry;
|
||
|
var $properties;
|
||
|
function addProperties($name,$value)
|
||
|
{
|
||
|
@$this->properties->$name=$value;
|
||
|
}
|
||
|
}
|
||
|
class GeoBox extends Geometry
|
||
|
{
|
||
|
function __construct($minx,$miny,$maxx,$maxy)
|
||
|
{
|
||
|
$this->type='Polygon';
|
||
|
$this->coordinates=array(array(array($minx,$miny),array($minx,$maxy),array($maxx,$maxy),array($maxx,$miny),array($minx,$miny)));
|
||
|
}
|
||
|
}
|
||
|
class GeoBoxLine extends Geometry
|
||
|
{
|
||
|
function __construct($minx,$miny,$maxx,$maxy)
|
||
|
{
|
||
|
$this->type='LineString';
|
||
|
$this->coordinates=array(array($minx,$miny),array($minx,$maxy),array($maxx,$maxy),array($maxx,$miny),array($minx,$miny));
|
||
|
}
|
||
|
}
|