LuciadCPillar can format point locations as strings in a number of output formats. This can be useful to display the map position of the mouse cursor on the map, for example.
Longitude-latitude coordinate formatting
You can use the LonLatFormat
LonLatFormat
LonLatFormat
to format points to longitude-latitude coordinates.
A pattern string determines the formatting of the coordinates:
LonLatFormat lonLatFormat{"lon(+DMS), lat(+DMS)"};
Coordinate coordinate{-123.456, 7.89};
std::string result = lonLatFormat.format(coordinate);
LonLatFormat lonLatFormat = new LonLatFormat("lon(+DMS), lat(+DMS)");
Coordinate coordinate = new Coordinate(-123.456, 7.89);
string result = lonLatFormat.Format(coordinate);
LonLatFormat lonLatFormat = new LonLatFormat("lon(+DMS), lat(+DMS)");
Coordinate coordinate = new Coordinate(-123.456, 7.89);
String result = lonLatFormat.format(coordinate);
Other coordinate formatting
MgrsFormat
MgrsFormat
MgrsFormat
formats points as MGRS or UTM/UPS coordinates.
It can also parse MGRS or UTM/UPS strings into points.
See Formatting and parsing points to/from MGRS for more information.