How to eliminate softwareserial from a sketch

It's actually not as hard as you are making it. The GPS library simply decodes strings that you feed it character by character. Normally the strings are fetched by reading from a GPS device via a serial port. In the example you posted it uses software serial by defining a serial object providing the pin numbers to use. To use the hardware Serial3 on your Mega, you should remove:

  • the inclusion of SoftwareSerial.h
  • the constants RXPin and TXPin
  • the software serial initialization SoftwareSerial ss(RXPin, TXPin);
    Then change:
  • the line ss.begin(GPSBaud); to Serial3.begin(GPSBaud);
  • all softwareserial activity by changing "ss." to "Serial3.".

One would use a similar idea if one was reading from an i2c or SPI connected GPS device, but serial connected GPS devices are much more common.