]> git.street.me.uk Git - andy/viking.git/blobdiff - src/coords.c
Don't remove project name if one decides not to delete all layers.
[andy/viking.git] / src / coords.c
index f1a2d06514bdc55be4fc016439b5f67a143b07b3..78f6ebcb3b91a439d003cf8ba1496b0c1c7572e7 100644 (file)
@@ -215,7 +215,6 @@ void a_coords_utm_to_latlon( const struct UTM *utm, struct LatLon *latlon )
     double N1, T1, C1, R1, D, M;
     double long_origin;
     double mu, phi1_rad;
-    int northernHemisphere;    /* 1 for northern hemisphere, 0 for southern */
     double latitude, longitude;
 
     northing = utm->northing;
@@ -226,13 +225,11 @@ void a_coords_utm_to_latlon( const struct UTM *utm, struct LatLon *latlon )
     /* Now convert. */
     x = easting - 500000.0;    /* remove 500000 meter offset */
     y = northing;
-    if ( ( *letter - 'N' ) >= 0 )
-       northernHemisphere = 1; /* northern hemisphere */
-    else
-       {
-       northernHemisphere = 0; /* southern hemisphere */
-       y -= 10000000.0;        /* remove 1e7 meter offset */
-       }
+    if ( ( *letter - 'N' ) < 0 ) {
+      /* southern hemisphere */
+      y -= 10000000.0; /* remove 1e7 meter offset */
+    }
+
     long_origin = ( zone - 1 ) * 6 - 180 + 3;  /* +3 puts origin in middle of zone */
     eccPrimeSquared = EccentricitySquared / ( 1.0 - EccentricitySquared );
     e1 = ( 1.0 - sqrt( 1.0 - EccentricitySquared ) ) / ( 1.0 + sqrt( 1.0 - EccentricitySquared ) );
@@ -277,6 +274,10 @@ void a_coords_latlon_to_string ( const struct LatLon *latlon,
     *lat = convert_lat_dec_to_dms ( latlon->lat );
     *lon = convert_lon_dec_to_dms ( latlon->lon );
     break;
+  case VIK_DEGREE_FORMAT_RAW:
+    *lat = g_strdup_printf ( "%.6f", latlon->lat );
+    *lon = g_strdup_printf ( "%.6f", latlon->lon );
+    break;
   default:
     g_critical("Houston, we've had a problem. format=%d", format);
   }