How to get current GPS location from Pixhawk?

Hello, I’m trying to write a program for the pixhawk that compares the drone’s current location (GPS coordinates) to already pre-established locations in my program.
When the current location of the drone matches one of the pre-established location I want to launch a script on my computer… I have searched various forums trying to find if there is a way to obtain the GPS location directly from the pixhawk. I want to do this without Qgroundcontrol… Any pointers?

subscribe to the topic “vehicle_global_position”

it contains the vehicle’s lat and lon.