You are here

protected function GeoRSS::getPointsFromCoords in geoPHP 7

Same name and namespace in other branches
  1. 8 geoPHP/lib/adapters/GeoRSS.class.php \GeoRSS::getPointsFromCoords()
3 calls to GeoRSS::getPointsFromCoords()
GeoRSS::parseLines in geoPHP/lib/adapters/GeoRSS.class.php
GeoRSS::parsePoints in geoPHP/lib/adapters/GeoRSS.class.php
GeoRSS::parsePolygons in geoPHP/lib/adapters/GeoRSS.class.php

File

geoPHP/lib/adapters/GeoRSS.class.php, line 83

Class

GeoRSS
PHP Geometry/GeoRSS encoder/decoder

Code

protected function getPointsFromCoords($string) {
  $coords = array();
  if (empty($string)) {
    return $coords;
  }
  $latlon = explode(' ', $string);
  foreach ($latlon as $key => $item) {
    if (!($key % 2)) {

      // It's a latitude
      $lat = $item;
    }
    else {

      // It's a longitude
      $lon = $item;
      $coords[] = new Point($lon, $lat);
    }
  }
  return $coords;
}