/** * @param WKBBuffer $buffer * @param CoordinateSystem $cs * * @return Point */ private function readPoint(WKBBuffer $buffer, CoordinateSystem $cs) { $coords = $buffer->readDoubles($cs->coordinateDimension()); return new Point($cs, ...$coords); }
/** * Returns the coordinate dimension of this geometry. * * The coordinate dimension is the total number of coordinates in the coordinate system. * * The coordinate dimension can be 2 (for x and y), 3 (with z or m added), or 4 (with both z and m added). * The ordinates x, y and z are spatial, and the ordinate m is a measure. * * @return integer */ public function coordinateDimension() { return $this->coordinateSystem->coordinateDimension(); }
/** * x y * * @param WKTParser $parser * @param CoordinateSystem $cs * * @return Point */ private function readPoint(WKTParser $parser, CoordinateSystem $cs) { $dim = $cs->coordinateDimension(); $coords = []; for ($i = 0; $i < $dim; $i++) { $coords[] = $parser->getNextNumber(); } return new Point($cs, ...$coords); }