Getting incorrect GPS Readings

So I am using Dragino Lora GPS Shield to get the gps readings. The tiny gps example works just fine but for some reason in a different code , I am unable to get the correct readings. I have attached the code and the thethingsnetwork payload image.

void GPSRead()
  unsigned long age;
  gps.f_get_position(&flat, &flon, &age);
  falt=gps.f_altitude();  //get altitude       
  flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6;//save six decimal places 
  flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6;
  falt == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : falt, 2;//save two decimal places
  int32_t lat = flat * 10000;
  int32_t lon = flon * 10000;
  int32_t alt = falt * 100;

  mydata[10] = lat >> 16;
  mydata[11] = lat >> 8;
  mydata[12] = lat;
  mydata[13] = lon >> 16;
  mydata[14] = lon >> 8;
  mydata[15] = lon;
  mydata[16] = alt >> 16;
  mydata[17] = alt >> 8;
  mydata[18] = alt;


HI there.
I notice from the code structure seems you are using the radioHead example sketch, in which I also using to getting started with TTN. From my experience the false coordinate happens to be occur because your GPS module not yet able to lock your location. My suggestion would be take your client device outside (have clear line of sight to the GPS satellite witch mean to the sky) for some minute, if you using Dragino LoRa starter kit for the experiment you’ll see the GPS LED will flashing when the GPS module get accurate coordinates (please reference the dragino documentation or wiki for precise resource). Once it get the reading you’ll receive the correct lon and lat in your application console.

Regarts, Vocational Internet Engineering student of Universitas Gadjah Mada - Yogyakarta