Esempio n. 1
0
 public function test_multipoint_ewkt()
 {
     $mp = MultiPoint::from_array(array(array(1.1, 2.2), array(3.3, 4.4)), 444);
     $this->assertEquals('SRID=444;MULTIPOINT(1.1 2.2,3.3 4.4)', $mp->to_ewkt());
     $mp = MultiPoint::from_array(array(array(1.1, 2.2, 3.3), array(4.4, 5.5, 6.6)), 444, true);
     $this->assertEquals('SRID=444;MULTIPOINT(1.1 2.2 3.3,4.4 5.5 6.6)', $mp->to_ewkt());
     $this->assertEquals('MULTIPOINT(1.1 2.2,4.4 5.5)', $mp->to_wkt());
     $mp = MultiPoint::from_array(array(array(1.1, 2.2, 3.3, -23), array(4.4, 5.5, 6.6, 0)), 444, true, true);
     $this->assertEquals('SRID=444;MULTIPOINT(1.1 2.2 3.3 -23,4.4 5.5 6.6 0)', $mp->to_ewkt());
 }
Esempio n. 2
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');
     }
 }