2017 © Pedro Peláez
 

library yii2-geo

An interface to generate geographic annotations in different formats

image

perspectivain/yii2-geo

An interface to generate geographic annotations in different formats

  • Monday, February 16, 2015
  • by jsopra
  • Repository
  • 4 Watchers
  • 3 Stars
  • 283 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

Yii2 Geo

An interface to generate geographic annotations in different formats., (*1)

Currently supports KML and geoJSON formats and MultiPolygon, Point and Polygon types., (*2)

More about geoJSON: http://geojson.org/geojson-spec.html

More about KML: https://developers.google.com/kml/documentation/

Usage

Create and action to response in geo format, (*3)

use perspectivain\geo\kml\Kml;
use perspectivain\geo\kml\models\Polygon;
use perspectivain\geo\kml\models\Point;

public function actionCityDistricts()
{
  $document = new Kml; //change to "new Geojson" to generate this file 
  $document->id = 'district';

  $districts = District::find()->all();
  foreach($districts as $district) {

      $polygon = new Polygon;

      foreach($district->coordinates as $coordinate) {
          $point = new Point;
          $point->value = $coordinate;
          $polygon->value[] = $point;
          unset($point);
      }

      $document->add($polygon);
      unset($polygon);
  }

  return $document->output();
}

And the return is an valid KML file, (*4)

Passing properties in object

To pass properties to object, do this:, (*5)

$polygon = new Polygon;
$polygon->extendedData = [
  'property' => 1,
];

Installing

The preferred way to install this extension is through composer., (*6)

``` { "require": { "perspectivain/yii2-geo": "*" } }, (*7)

The Versions

16/02 2015

dev-master

9999999-dev https://github.com/perspectivain/yii2-geo

An interface to generate geographic annotations in different formats

  Sources   Download

MIT

The Requires

 

by Juliano Baggio di Sopra

yii2 geojson kml