You are here

private function WKT::parseLineString in geoPHP 8

Same name and namespace in other branches
  1. 7 geoPHP/lib/adapters/WKT.class.php \WKT::parseLineString()
2 calls to WKT::parseLineString()
WKT::parseMultiLineString in geoPHP/lib/adapters/WKT.class.php
WKT::parsePolygon in geoPHP/lib/adapters/WKT.class.php

File

geoPHP/lib/adapters/WKT.class.php, line 70

Class

WKT
WKT (Well Known Text) Adapter

Code

private function parseLineString($data_string) {
  $data_string = $this
    ->trimParens($data_string);

  // If it's marked as empty, then return an empty line
  if ($data_string == 'EMPTY') {
    return new LineString();
  }
  $parts = explode(',', $data_string);
  $points = array();
  foreach ($parts as $part) {
    $points[] = $this
      ->parsePoint($part);
  }
  return new LineString($points);
}