Example #1
0
 /**
  * PostGIS doesn't put parens around each point.  The specification
  * does.  Have to handle both cases here.
  */
 private function parse_multi_point()
 {
     if ($this->tokenizer->get_next_token() != '(') {
         throw new EWKTFormatError('Invalid MULTIPOINT');
     }
     $token = $this->tokenizer->check_next_token();
     if ($token == '(') {
         // Follow spec
         $token = '';
         $points = array();
         while ($token != ')') {
             $points[] = $this->parse_point();
             $token = $this->tokenizer->get_next_token();
             // comma
             if ($token === null) {
                 throw new EWKTFormatError('Incorrect termination of EWKT string');
             }
         }
         return MultiPoint::from_points($points, $this->srid, $this->with_z, $this->with_m);
     } else {
         // PostGIS format
         return $this->parse_point_list('MultiPoint');
     }
 }