NEO-M9N, U.FL - How to calculate coordinates

I am trying to understand how to convert GPS coordinates from google maps to use in one of the example sketches.

SparkFun u-blox GNSS Arduino Library → Example17_Geofence

Google Maps coordinates : 40.68947716486538, -74.04446821564673

How to I convert these use with the SparkFun_u-blox_GNSS_Arduino_Library

Serial.println(myGNSS.addGeofence(latitude, longitude, radius, confidence));

https://www.pgc.umn.edu/apps/convert/

YellowDog:
https://www.pgc.umn.edu/apps/convert/

Which values would I use?

The coordinates you have in your post are decimal degrees and the sparkfun library appears to use those as well.

The example appears to be looking for a coordinate with 7 positions after the decimal place so all you need to do is drop everything after the 7th decimal.

40.68947716486538, -74.04446821564673

These have 14 positions after the decimal so you're going to chop off the last 7 getting this:

40.6894771, -74.0444682

Also, you need 4 sets of coordinates to create a box around what you’re defining a fence around according to the example.

myGNSS.getLatitude() or myGNSS.getLongitude() never has any decimal point. There must be some conversion which I am unable to figure out.

One of the remarks say “Get the longitude in degrees * 10^-7” so I believe I need to know how to do the conversion backwards with values like 40.68947716486538, -74.04446821564673.

myGNSS.getLatitude() or myGNSS.getLongitude() never has any decimal point

Were you expecting a text string? The coordinates are stored internally either as floating point variables (declared double or float) or as 32 bit integers, in degrees*(1 or 10) million.

Post the code, using code tags.

Sorry, I am not explaining it right. As another example, the “Example31_Great_Circle_Distances” sketch. In it the SparkFun offices is used …

static const long TARGET_LAT = 400909142, TARGET_LON = -1051849833; // SparkFun's location: degrees * 10^-7 (40.091 N, 105.185 W)

https://www.google.com/maps/place/40%C2 … 4d-105.185

Tells me the location is 40.091000, -105.185000. what formula is used to convert to the same values used in the sketch ( 400909142, -1051849833)?

Basic decimal arithmetic.

On the computer, divide the integer value by 10 million, using floating point division, to get the floating point value.

Conversely, multiply the floating point value by 10 million to get the integer value.

jremington:
Basic decimal arithmetic.

On the computer, divide the integer value by 10 million, using floating point division, to get the floating point value.

Conversely, multiply the floating point value by 10 million to get the integer value.

Thanks!