Calculadoras_DDA / convert.py
gui-sparim's picture
Upload 6 files
204827e
raw
history blame
5.8 kB
import gradio as gr
import numpy as np
def execute(lat, long):
def TM_Y():
return (5000000) + (0.999995) * ( ((6378137)*(((1-(((2*(1/298.257222101)) - ((1/298.257222101)**2))/4)-((3*((2*(1/298.257222101)) - ((1/298.257222101)**2))**2)/64)-((5*((2*(1/298.257222101)) - ((1/298.257222101)**2))**3)/256))*(np.radians(lat))) - (((3/8)*(((2*(1/298.257222101)) - ((1/298.257222101)**2))+((((2*(1/298.257222101)) - ((1/298.257222101)**2))**2)/4)+((15*((2*(1/298.257222101)) - ((1/298.257222101)**2))**3)/128)))*np.sin(2*(np.radians(lat)))) + (((15/256)*((2*(1/298.257222101) - (1/298.257222101)**2)**2 + ((3*(2*(1/298.257222101) - (1/298.257222101)**2)**3)/4)))*np.sin(4*(np.radians(lat)))) - ((35*((2*(1/298.257222101) - (1/298.257222101)**2))**3 / 3072)*np.sin(6*(np.radians(lat)))))) -
(0) +
(((np.radians(long)-(-0.890117918517108))**2 / 2)*(6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)))*np.sin(np.radians(lat))*np.cos(np.radians(lat))) +
(((np.radians(long)-(-0.890117918517108))**4 / 24) * (6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2))) * np.sin(np.radians(lat)) * (np.cos(np.radians(lat)))**3 * (4*((6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)))/(((6378137*(1-(2*(1/298.257222101) - (1/298.257222101)**2)))/(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)**(3/2))))**2 + ((6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)))/(((6378137*(1-(2*(1/298.257222101) - (1/298.257222101)**2)))/(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)**(3/2)))) - (np.tan(np.radians(lat)))**2)) +
(((np.radians(long)-(-0.890117918517108))**6 / 720) * (6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2))) * np.sin(np.radians(lat)) * (np.cos(np.radians(lat)))**5 * ((8*((6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)))/(((6378137*(1-(2*(1/298.257222101) - (1/298.257222101)**2)))/(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)**(3/2))))**4 * (11-24*(np.tan(np.radians(lat)))**2)) - (28*((6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)))/(((6378137*(1-(2*(1/298.257222101) - (1/298.257222101)**2)))/(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)**(3/2))))**3 * (1-6*(np.tan(np.radians(lat)))**2)) + (((6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)))/(((6378137*(1-(2*(1/298.257222101) - (1/298.257222101)**2)))/(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)**(3/2))))**2 * (1-32*(np.tan(np.radians(lat)))**2)) - (((6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)))/(((6378137*(1-(2*(1/298.257222101) - (1/298.257222101)**2)))/(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)**(3/2)))) * (2*(np.tan(np.radians(lat)))**2)) + (np.tan(np.radians(lat)))**4)) +
(((np.radians(long)-(-0.890117918517108))**8 / 40320) * (6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2))) * np.sin(np.radians(lat)) * (np.cos(np.radians(lat)))**7 * (1385 - 3111*(np.tan(np.radians(lat)))**2 + 543*(np.tan(np.radians(lat)))**4 - (np.tan(np.radians(lat)))**6)))
def TM_X():
return 300000 + 0.999995 * (6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2))) * (np.radians(long)-(np.radians(-51.))) * np.cos(np.radians(lat)) * (1 + (((np.radians(long)-(np.radians(-51.)))**2 / 6) * (np.cos(np.radians(lat)))**2 * (((6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)))/(((6378137*(1-(2*(1/298.257222101) - (1/298.257222101)**2)))/(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)**(3/2)))) - (np.tan(np.radians(lat)))**2)) + (((np.radians(long)-(np.radians(-51.)))**4 / 120) * (np.cos(np.radians(lat)))**4 * (4*((6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)))/(((6378137*(1-(2*(1/298.257222101) - (1/298.257222101)**2)))/(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)**(3/2))))**3 * (1 - 6*(np.tan(np.radians(lat)))**2) + ((6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)))/(((6378137*(1-(2*(1/298.257222101) - (1/298.257222101)**2)))/(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)**(3/2))))**2 * (1+8*(np.tan(np.radians(lat)))**2) - ((6378137/(np.sqrt(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)))/(((6378137*(1-(2*(1/298.257222101) - (1/298.257222101)**2)))/(1-(2*(1/298.257222101) - (1/298.257222101)**2)*(np.sin(np.radians(lat)))**2)**(3/2))))*2*(np.tan(np.radians(lat)))**2 + (np.tan(np.radians(lat)))**4)) + (((np.radians(long)-(np.radians(-51.)))**6 / 5040) * (np.cos(np.radians(lat)))**6 * (61 - 479*(np.tan(np.radians(lat)))**2 + 179*(np.tan(np.radians(lat)))**4 - (np.tan(np.radians(lat)))**6)))
return TM_X(), TM_Y()
def load_inputs():
lat = gr.inputs.Number(default = -30.027300489258348, label='Latitude (WGS84)')
long = gr.inputs.Number(default = -51.22889665713565, label='Longitude (WGS84)')
return [lat, long]
output_label = "Coordenadas Convertidas"
title = 'Conversor de Coordenadas'
description = 'WGS84 para TM-POA'