Transfer of latitude and longitudes coordinates from one form to another

2 visualizaciones (últimos 30 días)
How can i change latitudes and longitudes in the following form to decimal form? Consider the coordinate (33°49'50"N 117°56'18"W) and show a simple way.
  5 comentarios
Thishan Dharshana Karandana Gamalathge
You have made it confused. Consider a geographical coordinate in degree,minutes,seconds form and convert it in to degree form. That's what I want to know.
Walter Roberson
Walter Roberson el 16 de Jun. de 2018
To give you the code, I need to know what the existing data structure is. Do I need to break apart strings to get the pieces and convert them to numeric? Are the values already pure numeric, and if so then how is N/S and E/W signaled? Are the values in a cell array so that the characters 'N', 'S', 'E', 'W' can be examined?

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 16 de Jun. de 2018
lat_dms = lat_degrees + lat_minutes / 60 + lat_seconds / 3600;
if strcmpi(lat_NS, 'S'); lat_dms = -lat_dms; end
long_dms = long_degrees + long_minutes / 60 + long_seconds / 3600;
if strcmpi(long_EW, 'W'); long_dms = -long_dms; end
result = [lat_dms, long_dms]

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by