stringToLatLon()

The function converts string coordinates into float coordinates.

Synopsis

bool stringToLatLon(string coordinate, float &lat, float &lon)

Parameter

Parameter Description
coordinate String coordinates to convert
lat Returned latitude value
lon Returned longitude value

Description

The function converts the stated string coordinates into float latitude and longitude values. The supported notation types can be found within the function description of latLonToString().

In addition to that a string just containing to float values can also be converted into coordinates where the first value is interpreted as latitude and the second value as longitude.

If the string contains single characters representing North, South, East or West these characters determine which value is interpreted as longitude or latitude and not the stated order. These characters can be stated before or after the values and e.g. following examples will all return the same latitude and longitude pair:

74.2245 -32.2434
74.2245 N 32.2434 W
32.2434 W 74.2245 N
N 74.2245 W 32.2434
W 32.2434 N 74.2245

The function returns true if the conversion was successful and false in case of an error.

Assignment

Maps Widget

See also

latLonToString()