u-blox gps lea-6h / Mega2560

How to read COG and Velocity??(3D) from (3DR GPS uBlox LEA-6h-002) using APM 2.5?..

The connection is made by the SPI port (not the UART port), as shown in the following images:

http://s2.subirimagenes.com/otros/previo/thump_878803210.jpg
http://s2.subirimagenes.com/fotos/previo/thump_8788034dsc0053.jpg

Basically I need a code (Arduino IDE) to read the COG (Course Over Ground) and the velocity (3D), but I do not know how to build it. Is There an expert who can guide me please?