Created
April 1, 2021 08:23
-
-
Save gabyfle/674c38051f18c0c02da806bd872a4798 to your computer and use it in GitHub Desktop.
mercator projection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using Mercator projection formula | |
def mercator(lon, lat, width = 14, height = 8): | |
lon, lat, width, height = float(lon), float(lat), float(width), float(height) | |
r = width / (2 * PI) | |
x = r * np.radians(lon) | |
y = (height / 2) - r * np.log(np.tan(PI / 4 + np.radians(lat) / 2)) | |
return np.array([x, y, 0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment