Skip to content

util — coordinates / utilities

Coordinate conversion, distance and azimuth utilities

GLuint createTexture()

Create a name of OpenGL Texture.

None

OpenGL Texture Name


GLuint deleteTexture( GLuint tex )

Delete a name of OpenGL Texture.

GLuint tex : IN (OpenGL Texture Name)

Always 0


double distVincenty( double lat1, double lon1, double lat2, double lon2 )

Calculate the distance between diameters according to Vincenty’s algorithm. The calculation results are slower but more accurate than other algorithms.

  • double lat1 : IN (Latitude, degree)
  • double lon1 : IN (Longitude, degree)
  • double lat2 : IN (Latitude, degree)
  • double lon2 : IN (Longitude, degree)

Distance between two latitudes and longitudes (in meters)


double distHaversine( double lat1, double lon1, double lat2, double lon2 )

Calculate the distance between diameters according to Haversine algorithm. The result is faster than other algorithms but less accurate.

  • double lat1 : IN (Latitude, degree)
  • double lon1 : IN (Longitude, degree)
  • double lat2 : IN (Latitude, degree)
  • double lon2 : IN (Longitude, degree)

Distance between two latitudes and longitudes (in meters)


void destVincenty(double lat1, double lon1, double bearing, double dist, double &lat2out, double &lon2out)

Calculate the latitude and longitude values of the coordinates corresponding to angles and distances from one latitude and longitude point using the Vincenty algorithm.

  • double lat1 : IN (Latitude, degree)
  • double lon1 : IN (Longitude, degree)
  • double dist : IN (Distance, meter)
  • double bearing : IN (Angle, degree, 0 degrees at 12 o’clock, CW)
  • double &lat2out : OUT (Latitude, degree)
  • double &lon2out : OUT (Latitude, degree)

None


double calcAzimuth( double Lat1, double Long1, double Lat2, double Long2 )

Compute azimuths based on north-south directions between two latitudes and longitudes.

  • double Lat1 : IN (Latitude, degree)
  • double Long1 : IN (Longitude, degree)
  • double Lat2 : IN (Latitude, degree)
  • double Long2 : IN (Longitude, degree)

Azimuth between two latitudes and longitudes (0 degree northward direction, CW, degree)


string_t floatToDegStr( double pos )

Function to convert the degree value to a string of the form xx°yy’zz”

double pos : IN (Angle given as float number, degree)

String of form xx°yy’zz”

string_t floatToDegStr( double lat, double lon )

Function to convert the latitude and longitude values into a string of the form xx°yy’zz” N/S, xx°yy’zz” E/W

  • double lat : IN (Latitude)
  • double lon : IN (Longitude)

String of form xx°yy’zz” X/Y (X is N or E, Y is S or W)