PHP Class WkbPolyline, google-map-polyline-encoding-tool

An example class to convert well-known binary files to Google encoded strings This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see .
Inheritance: extends Polyline
Datei anzeigen Open project: emcconville/google-map-polyline-encoding-tool

Protected Properties

Property Type Description
$cursor
$endianness
$fd

Public Methods

Method Description
encodeFromBlob ( string $blob ) : string Encoded WKB from blob
encodeFromFile ( string $filename ) : string Parse binary file & converts WKB to google encoded string.

Protected Methods

Method Description
chunk ( integer $size = 1 ) : string Pulls data directly from file descriptor by given length.
parseWkb ( ) : array Extract points from well-known binary
readByte ( ) : integer Read single byte from file descriptor.
readDouble ( ) : double Read 8 bytes and cast to double. Respects file endianness.
readU32 ( ) : integer Read 4 bytes and cast to unsigned integer. Respects file endianness.

Method Details

chunk() protected method

Pulls data directly from file descriptor by given length.
protected chunk ( integer $size = 1 ) : string
$size integer - Default 1
return string - Binary safe string.

encodeFromBlob() public method

This method will copy the given blob to memory descriptor. There's better ways to do this.
public encodeFromBlob ( string $blob ) : string
$blob string - Binary safe string
return string

encodeFromFile() public method

Parse binary file & converts WKB to google encoded string.
public encodeFromFile ( string $filename ) : string
$filename string - The path to the binary file to be encoded.
return string - Encoded string

parseWkb() protected method

Extract points from well-known binary
protected parseWkb ( ) : array
return array - Points found in binary

readByte() protected method

Read single byte from file descriptor.
protected readByte ( ) : integer
return integer - Order of byte.

readDouble() protected method

Read 8 bytes and cast to double. Respects file endianness.
protected readDouble ( ) : double
return double

readU32() protected method

Read 4 bytes and cast to unsigned integer. Respects file endianness.
protected readU32 ( ) : integer
return integer

Property Details

$cursor protected_oe property

protected $cursor

$endianness protected_oe property

protected $endianness

$fd protected_oe property

protected $fd