Skip to content

Instantly share code, notes, and snippets.

@heathhenley
Created June 9, 2022 14:33
Show Gist options
  • Select an option

  • Save heathhenley/f751e90d5c939324f940728695a30d71 to your computer and use it in GitHub Desktop.

Select an option

Save heathhenley/f751e90d5c939324f940728695a30d71 to your computer and use it in GitHub Desktop.
import numpy as np
import utm
starting_lat = -16.770190621116416
starting_lon = 145.94309647258999
x, y, zone, letter = utm.from_latlon(starting_lat, starting_lon)
# Scalar
print(starting_lat, starting_lon, x, y)
lat_scalar, lon_scalar = utm.to_latlon(x, y, zone, letter)
print(lat_scalar, lon_scalar, x, y)
x, y, zone, letter = utm.from_latlon(starting_lat, starting_lon)
# Using np.array()
x = np.array(x) # np.ones(3) * x
y = np.array(y) # np.ones(3) * y
print(starting_lat, starting_lon, x, y)
lat_vector, lon_vector = utm.to_latlon(x, y, zone, letter)
print(lat_vector, lon_vector, x, y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment