コード例 #1
0
ファイル: PDGeodesia.py プロジェクト: ohisama/pyrinex
 def Rk4o(self,NombreElipsoide,pasos=None):
     '''!
     '''
     az=self.__az.getAngulo()
     lat=self.__lat.getAngulo()
     lon=self.__lon.getAngulo()
     s=self.__d
     radios=radcur.RadiosDeCurvatura(NombreElipsoide)
     if pasos==None:
         if s<=1000:
             pasos=100
         elif s>1000 or s<=10000:
             pasos=1000
         elif s>10000 or s<=100000:
             pasos=10000
         elif s>100000 or s<=1000000:
             pasos=100000
         else:
             pasos=750000
     
     h=s/pasos
     latact=lat
     lonact=lon
     azact=az
     for i in range(pasos):
         nhu=radios.getRadioPrimerVertical(latact)
         ro=radios.getRadioElipseMeridiana(latact)
         k1=h*(cos(azact)/ro)
         m1=h*(sin(azact)/(nhu*cos(latact)))
         n1=h*((tan(latact)*sin(azact))/(nhu))
         
         nhu=radios.getRadioPrimerVertical(latact+(k1/2))
         ro=radios.getRadioElipseMeridiana(latact+(k1/2))
         k2=h*(cos(azact+(n1/2))/ro)
         m2=h*(sin(azact+(n1/2))/(nhu*cos(latact+(k1/2))))
         n2=h*((tan(latact+(k1/2))*sin(azact+(n1/2)))/(nhu))
         
         nhu=radios.getRadioPrimerVertical(latact+(k2/2))
         ro=radios.getRadioElipseMeridiana(latact+(k2/2))
         k3=h*(cos(azact+(n2/2))/ro)
         m3=h*(sin(azact+(n2/2))/(nhu*cos(latact+(k2/2))))
         n3=h*((tan(latact+(k2/2))*sin(azact+(n2/2)))/(nhu))
         
         nhu=radios.getRadioPrimerVertical(latact+(k3))
         ro=radios.getRadioElipseMeridiana(latact+(k3))
         k4=h*(cos(azact+(n3))/ro)
         m4=h*(sin(azact+(n3))/(nhu*cos(latact+(k3))))
         n4=h*((tan(latact+(k3))*sin(azact+(n3)))/(nhu))
         
     
         latact+=((1/6)*(k1+2*k2+2*k3+k4))
         lonact+=((1/6)*(m1+2*m2+2*m3+m4))
         azact+=((1/6)*(n1+2*n2+2*n3+n4))
     #print(latact,lonact,azact)
     if azact<pi:
         azact+=pi
     elif azact>=pi:
         azact-=pi
     return latact,lonact,azact
コード例 #2
0
def Cargeo2Geo(Punto, NombreElipsoide):
    '''
    @brief: Funcion que transforma de Coordenadas Cartesianas Geocentricas a Geodesicas Elipsoidales.
    
    @param Punto Punto3D: Punto3D con las coordenadas Cartesianas Geocentricas.
    @param NombreElipsoide str: Nombre del elipsoide de calculo.
    
    @raise Valor Punto3D: Se produce una excepción en el caso de que el punto introducido no sea de tipo punto3D.
    @raise Valor Nombre Elipsoide: Se produce una excepción en el caso que el el Nombre del elipsoide no sea de tipo String.
                                   
    @return PuntoGeodesico: Punto Geodesico con el resultado.
    '''
    if not isinstance(Punto, pt3.Punto3D):
        raise Exception(
            "Se esperaba un objeto de la clase Punto3D como primer valor de entrada del constructor."
        )

    try:
        NombreElipsoide = str(NombreElipsoide)
    except:
        raise Exception(
            "Se esperaba un str como segundo valor entrada de la función.")

    x = Punto.getX()
    y = Punto.getY()
    z = Punto.getZ()
    #Calculo de parámetros.
    Elipsoide = Elip.Elipsoides(NombreElipsoide)
    e = Elipsoide.getPrimeraExcentricidad()
    #Calculos auxiliares
    r = sqrt((x**2) + (y**2))
    latact = atan((z / r) / (1.0 - (e**2)))
    latiter = 0.0
    helip = 0.0
    cont = 0
    aux = Rad.RadiosDeCurvatura(NombreElipsoide)
    while abs(latact - latiter) > 0.000000000001:
        if cont != 0:
            latact = latiter
        nhu = aux.getRadioPrimerVertical(latact)
        helip = (r / cos(latact)) - nhu
        latiter = atan((z / r) / (1.0 - ((e**2) * (nhu / (nhu + helip)))))
        cont += 1
    '''
    Casos del arcotangente CUADRANTES
    '''

    Lat = ang.Angulo(latiter, formato='radian')
    Lon = ang.Angulo(atan(y / x), formato='radian')
    Lat.Convertir('latitud')
    Lon.Convertir('longitud180')

    return pgeo.PuntoGeodesico(Lat, Lon, helip)
コード例 #3
0
ファイル: Geo2Cargeo.py プロジェクト: joseahr/geomatica
def Geo2Cargeo(PuntoGeodesico, NombreElipsoide):
    '''
    @brief: Funcion que transforma de Coordenadas geodesicas a coordenadas Cartesianaes Geocentricas.
    
    @param PuntoGeodesico PuntoGeodesico: Punto Geodesico con las coordenadas del punto.
    @param NombreElipsoide str: Nombre del elipsoide de calculo.
    
    @raise Valor Punto Geodesico: Se produce una excepción en el caso de que el punto introducido
                                  no sea de tipo puntoGeodesico.
    @raise Valor Nombre Elipsoide: Se produce una excepción en el caso que el el Nombre del elipsoide
                                   no sea de tipo String.
                                   
    @return Punto3D: Valor del punto calculado.
    '''
    if not isinstance(PuntoGeodesico, pgeo.PuntoGeodesico):
        raise Exception("Valor Punto Geodesico")

    try:
        NombreElipsoide = str(NombreElipsoide)
    except:
        raise Exception("Valor Nombre Elipsoide")

    Latitud = ang.Angulo(PuntoGeodesico.getLatitud(), formato='latitud')
    Longitud = ang.Angulo(PuntoGeodesico.getLongitud(), formato='longitud180')
    AlturaElipsoidal = PuntoGeodesico.getAlturaElipsoidal()

    #Conversion a radian.
    Latitud.Convertir('radian')
    Longitud.Convertir('radian')
    #Calculo de parámetros.
    Elipsoide = Elip.Elipsoides(NombreElipsoide)
    e = Elipsoide.getPrimeraExcentricidad()
    nhu = Rad.RadiosDeCurvatura(NombreElipsoide).getRadioPrimerVertical(
        Latitud.getAngulo())
    #Cálculo de Coordenadas.
    X = (nhu + AlturaElipsoidal) * (cos(Latitud.getAngulo())) * (cos(
        Longitud.getAngulo()))
    Y = (nhu + AlturaElipsoidal) * (cos(Latitud.getAngulo())) * (sin(
        Longitud.getAngulo()))
    Z = (nhu * (1.0 - (e**2)) + AlturaElipsoidal) * (sin(Latitud.getAngulo()))

    return pt3.Punto3D(X, Y, Z, negativos=True)
コード例 #4
0
ファイル: RAC.py プロジェクト: ohisama/pyrinex
def RAC(puntoUTM1,puntoUTM2,NombreElipsoide):
    '''!
    '''
    radcur=rcur.RadiosDeCurvatura(NombreElipsoide)
    elip=elipsoides.Elipsoides(NombreElipsoide)
    #punto1
    angaux=ang.Angulo()
    geo1=utm2geo.UTM2Geo(puntoUTM1, NombreElipsoide)
    angaux.setAngulo(geo1.getLatitud())
    angaux.setFormato('pseudosexagesimal')
    angaux.Convertir('raidian')
    nhu1=radcur.getRadioPrimerVertical(angaux.getAngulo())
    ro1=radcur.getRadioElipseMeridiana(angaux.getAngulo())
    x1=(puntoUTM1.getX()-500000)/(0.9996)
    y1=puntoUTM1.getY()/0.9996
    n21=((elip.getSegundaExcentricidad()**2))*((cos(angaux.getAngulo())**2))
    #punto2
    angaux=ang.Angulo()
    geo2=utm2geo.UTM2Geo(puntoUTM2, NombreElipsoide)
    angaux.setAngulo(geo2.getLatitud())
    angaux.setFormato('pseudosexagesimal')
    angaux.Convertir('raidian')
    nhu2=radcur.getRadioPrimerVertical(angaux.getAngulo())
    ro2=radcur.getRadioElipseMeridiana(angaux.getAngulo())
    x2=(puntoUTM2.getX()-500000)/(0.9996)
    y2=puntoUTM2.getY()/0.9996
    n22=((elip.getSegundaExcentricidad()**2))*((cos(angaux.getAngulo())**2))
    #calculoRAC
    nhum=(nhu1+nhu2)/2.0
    rom=(ro1+ro2)/2.0
    nm=(n21+n22)/2.0
    RAC12=((y2-y1)*(2.0*x1+x2)*(1+nm))/(6.0*nhum*rom)
    RAC21=((y2-y1)*(2.0*x2+x1)*(1+nm))/(6.0*nhum*rom)
    
    return RAC12,RAC21
    
    
    
コード例 #5
0
 def Calcular(self):
     '''!
     '''
     if self.lineEdit.text()=="":
         self.__msgBoxErr.setText("Debe introducir un valor para la latitud origen.")
         self.__msgBoxErr.exec_()
         return
     if self.lineEdit_2.text()=="":
         self.__msgBoxErr.setText("Debe introducir un valor para la la longitud origen.")
         self.__msgBoxErr.exec_()
         return
     if self.lineEdit_3.text()=="":
         self.__msgBoxErr.setText("Debe introducir un valor para la latitud destino.")
         self.__msgBoxErr.exec_()
         return
     if self.lineEdit_4.text()=="":
         self.__msgBoxErr.setText("Debe introducir un valor para la la longitud destino.")
         self.__msgBoxErr.exec_()
         return
     
     try:
         sal=pig.PIGeodesia(pgeo.PuntoGeodesico(self.lineEdit.text(),self.lineEdit_2.text()),pgeo.PuntoGeodesico(self.lineEdit_3.text(),self.lineEdit_4.text()))   
         az,d=sal.CalcularBessel(self.comboBox.currentText())
     except Exception as e:
         self.__msgBoxErr.setText(e.__str__())
         self.__msgBoxErr.exec_()
         
     a1=ang.Angulo(az,girar=True)
     a1.Convertir('pseudosexagesimal')
     self.lineEdit_6.setText(str(a1.getAngulo()))
     Radio=rcurv.RadiosDeCurvatura(self.comboBox.currentText())
     nhu1=Radio.getRadioPrimerVertical(float(self.lineEdit.text()))
     ro1=Radio.getRadioElipseMeridiana(float(self.lineEdit.text()))
     nhu2=Radio.getRadioPrimerVertical(float(self.lineEdit_3.text()))
     ro2=Radio.getRadioElipseMeridiana(float(self.lineEdit_3.text()))
     from math import sqrt
     Rm=(1/2)*((sqrt(nhu1*ro1))+(sqrt(nhu2*ro2)))
     self.lineEdit_5.setText(str(d*Rm))
コード例 #6
0
def Geo2UTM(PuntoGeodesico, NombreElipsoide, Huso=None, w=True, kp=True):
    '''!
    @brief: Método que convierte coordenadas Geodésicas elipsoidales a coordenadas UTM.
    @param PuntoGeodesico PuntoGeodesico: Punto Geodesico con las coordenadas del punto.
    @param NombreElipsoide str: Nombre del elipsoide de calculo.
    @param Huso int: Valor del Huso en el caso de que se quieran forzar las coordenadas a ese Huso.                            
    @return PuntoUTM: Punto con las coordenadas UTM transformadas.
    '''
    if not isinstance(PuntoGeodesico, pgeo.PuntoGeodesico):
        raise Exception("Valor Punto Geodesico")

    try:
        NombreElipsoide = str(NombreElipsoide)
    except:
        raise Exception("Valor Nombre Elipsoide")

    #Conversion a radian.
    Latitud = ang.Angulo(PuntoGeodesico.getLatitud(), formato='latitud')
    Latitud.Convertir('radian')
    Lat = Latitud.getAngulo()
    Longitud = ang.Angulo(PuntoGeodesico.getLongitud(), formato='longitud180')
    Longitud.Convertir('radian')
    Lon = Longitud.getAngulo()
    AlturaElipsoidal = PuntoGeodesico.getAlturaElipsoidal()

    #Calculo de parámetros del elipsoide.
    Elipsoide = Elip.Elipsoides(NombreElipsoide)
    nhu = Rad.RadiosDeCurvatura(NombreElipsoide).getRadioPrimerVertical(Lat)
    e = Elipsoide.getPrimeraExcentricidad()
    e2 = Elipsoide.getSegundaExcentricidad()
    #Valores Auxiliares
    t = tan(Lat)
    t2 = (t**2)
    t4 = (t**4)
    t6 = (t**6)
    t8 = (t**8)
    n2 = ((e2**2)) * ((cos(Lat)**2))
    n4 = (n2**2)
    n6 = (n2**3)
    n8 = (n2**4)
    n10 = (n2**5)
    n12 = (n2**6)
    n14 = (n2**7)
    #Claculo de las series de terminos.
    #x cubo.
    x3 = (1.0 - t2 + n2)
    #x quinta.
    x5 = (5.0 - 18.0 * t2 + t4 + 14.0 * n2 - 58.0 * n2 * t2 + 13.0 * n4 -
          64.0 * n4 * t2 + 4.0 * n6 - 24.0 * n6 * t2)
    #x septima.
    x7 = (61.0 - 479.0 * t2 + 179.0 * t4 - t6 + 331.0 * n2 - 3298.0 * n2 * t2 +
          177.0 * n2 * t4 + 715.0 * n4 - 8655.0 * n4 * t2 + 6080.0 * n4 * t4 +
          769.0 * n6 - 10964.0 * n6 * t2 + 9480.0 * n6 * t4 + 412.0 * n8 -
          5176.0 * n8 * t2 + 6912.0 * n8 * t4 + 88.0 * n10 -
          1632.0 * n10 * t2 + 1920.0 * n10 * t4)
    #x novena.
    x9 = (1385.0 - 20480.0 * t2 + 20690.0 * t4 - 1636.0 * t6 + t8 +
          12284.0 * n2 - 173088.0 * n2 * t2 + 201468.0 * n2 * t4 -
          54979.0 * n2 * t6 - 21.0 * n2 * t8 + 45318.0 * n4 -
          883449.0 * n4 * t2 + 14499197.0 * n4 * t4 - 390607.0 * n4 * t6 -
          14.0 * n4 * t8 + 90804.0 * n6 - 2195193.0 * n6 * t2 +
          549800.0 * n6 * t4 - 1394064.0 * n6 * t6 + 104073.0 * n8 -
          2875680.0 * n8 * t2 + 7041648.0 * n8 * t4 - 2644992.0 * n8 * t6 +
          68568.0 * n10 - 2115840.0 * n10 * t2 + 5968512.0 * n10 * t4 -
          2741760.0 * n10 * t6 + 25552.0 * n12 - 880192.0 * n12 * t2 +
          2811456.0 * n12 * t4 - 1474560.0 * n12 * t6 + 4672.0 * n14 -
          175680.0 * n14 * t2 + 603648.0 * n14 * t4 - 322560.0 * n14 * t6)
    #y cuarta.
    y4 = (5.0 - t2 + 9.0 * n2 + 4.0 * n4)
    #y sexta.
    y6 = (61.0 - 58.0 * t2 + t4 + 270.0 * n2 - 330.0 * n2 * t2 + 445.0 * n4 -
          680.0 * n4 * t2 + 324.0 * n6 - 600.0 * n6 * t2 + 88.0 * n8 -
          192.0 * n8 * t2)
    #y octava.
    y8 = (1385.0 - 3595.0 * t2 + 543.0 * t4 - t6 + 10899.0 * n2 -
          18634.0 * n2 * t2 + 10787.0 * n2 * t4 + 7.0 * n2 * t6 +
          34419.0 * n4 - 120582.0 * n4 * t2 + 49644.0 * n4 * t4 +
          56385.0 * n6 - 252084.0 * n6 * t2 + 121800.0 * n6 * t4 +
          47688.0 * n8 - 242496.0 * n8 * t2 + 151872.0 * n8 * t4 +
          20880.0 * n10 - 121920.0 * n10 * t2 + 94080.0 * n10 * t4 +
          4672.0 * n12 - 30528.0 * n12 * t2 + 23040.0 * n12 * t4)

    #Calculo de lam.
    s1 = sin(Lat)
    s3 = (s1**3)
    s5 = (s1**5)
    s7 = (s1**7)
    s9 = (s1**9)
    c1 = cos(Lat)
    g1 = Lat
    g2 = 1.5 * (e**2) * ((-0.5 * s1 * c1) + 0.5 * Lat)
    g3 = (15.0 / 8.0) * (e**4) * ((-0.25 * s3 * c1) - ((3.0 / 8.0) * s1 * c1) +
                                  ((3.0 / 8.0) * Lat))
    g4 = (35.0 / 16.0) * (e**6) * ((-(1.0 / 6.0) * s5 * c1) -
                                   ((5.0 / 24.0) * s3 * c1) -
                                   ((5.0 / 16.0) * s1 * c1) +
                                   ((5.0 / 16.0) * Lat))
    g5 = (315 / 128) * (e**8) * ((-(1 / 8) * s7 * c1) - ((7 / 48) * s5 * c1) -
                                 ((35 / 192) * s3 * c1) -
                                 ((35 / 128) * s1 * c1) + ((35 / 128) * Lat))
    g6 = (693 / 256) * (e**10) * ((-(1 / 10) * s9 * c1) -
                                  ((9 / 80) * s7 * c1) -
                                  ((21 / 160) * s5 * c1) -
                                  ((21 / 128) * s3 * c1) -
                                  ((63 / 256) * s1 * c1) + ((63 / 256) * Lat))
    lam = Elipsoide.getSemiEjeMayor() * (1 - (e**2)) * (g1 + g2 + g3 + g4 +
                                                        g5 + g6)

    #Calculo del Huso.
    if Huso == None:
        Huso = floor(((180.0 + Lon * (180 / pi)) / 6) + 1)
        lon0 = ang.Angulo((Huso * 6) - 183, formato='pseudosexagesimal')
        lon0.Convertir('radian')
        lon0 = lon0.getAngulo()
        #print(lon0)
    else:
        Huso = int(Huso)
        #Meridiano central.
        lon0 = ang.Angulo((Huso * 6) - 183, formato='pseudosexagesimal')
        lon0.Convertir('radian')
        lon0 = lon0.getAngulo()
        lon0d = lon0 + 0.05817764173314432  #3º20'
        lon0i = lon0 - 0.05817764173314432
        #print(lon0d,lon0i,Lon)
        if Lon < lon0i or Lon > lon0d:
            raise Exception(
                "Solo se pueden forzar las coordenadas a los Husos adyacentes un máximo de 20', si estas se en cuentran en el extremo del Huso"
            )

    #Incremento de longitud.
    Alon = Lon - lon0
    #Calculo de X.
    c3 = (c1**3)
    c5 = (c1**5)
    c7 = (c1**7)
    c9 = (c1**9)
    X = 500000.0 + (0.9996 *
                    ((Alon * nhu * c1) + (((Alon**3) / 6.0) * nhu * c3 * x3) +
                     (((Alon**5) / 120.0) * nhu * c5 * x5) +
                     (((Alon**7) / 5040.0) * nhu * c7 * x7) +
                     (((Alon**9) / 362880.0) * nhu * c9 * x9)))
    #Calculo de Y.
    c2 = (cos(Lat)**2)
    c4 = (cos(Lat)**4)
    c6 = (cos(Lat)**6)
    c8 = (cos(Lat)**8)
    Y = 0.9996 * (lam + (((Alon**2) / 2.0) * nhu * t * c2) +
                  (((Alon**4) / 24.0) * nhu * t * c4 * y4) +
                  (((Alon**6) / 720.0) * nhu * t * c6 * y6) +
                  (((Alon**8) / 40320.0) * nhu * t * c8 * y8))

    # Si la latiud está en el Hemisferio Sur:
    if Latitud.getAngulo() < 0:
        Y = 10000000.0 - Y

    #Cálculo de la convergencia de meridianos.
    #coeficientes.
    if w:
        m3 = (1.0 + 3.0 * n2 + 2 * n4)
        m5 = (2.0 - t2 + 15.0 * n2 * t2 + 35.0 * n4 - 50.0 * n4 * t2 +
              33.0 * n6 - 60.0 * n6 * t2 + 11.0 * n8 - 24.0 * n8 * t2)
        m7 = (-148.0 - 3427.0 * t2 + 18.0 * t4 - 1387.0 * t6 + 2023.0 * n2 -
              46116.0 * n2 * t2 + 5166.0 * n2 * t4 + 18984.0 * n4 -
              100212.0 * n4 * t4 + 34783 * n6 - 219968.0 * n6 * t2 +
              144900.0 * n6 * t4 + 36180.0 * n8 - 261508.0 * n8 * t2 +
              155904.0 * n8 * t4 + 18472.0 * n10 - 114528.0 * n10 * t2 +
              94080.0 * n10 * t4 + 4672.0 * n12 - 30528.0 * n12 * t2 +
              23040.0 * n12 * t4)
        convmed = (Alon * s1) + (((Alon**3) / 3.0) * s1 * c2 * m3) + ((
            (Alon**5) / 15.0) * s1 * c4 * m5) + ((
                (Alon**7) / 5040.0) * s1 * c6 * m7)
        convmed = ang.Angulo(convmed, formato='radian')
        convmed.Convertir('pseudosexagesimal')
        convmed = convmed.getAngulo()
    else:
        convmed = None
    #Calculo de la escala local del punto.
    #coeficientes.
    if kp:
        k2 = (1 + n2)
        k4 = (5.0 - 4.0 * t2 + 14.0 * n2 - 28.0 * n2 * t2 + 13.0 * n4 -
              48.0 * n4 * t2 + 4.0 * n6 - 24.0 * n6 * t2)
        k6 = (61.0 + 10636.0 * t2 - 9136.0 * t4 + 224.0 * t6 + 331.0 * n2 +
              44432.0 * n2 * t2 - 50058.0 * n2 * t4 - 715.0 * n4 +
              68100.0 * n4 * t2 - 95680.0 * n4 * t4 + 769.0 * n6 +
              43816.0 * n6 * t2 - 80160.0 * n6 * t4 + 412.0 * n8 +
              9644.0 * n8 * t2 - 21888.0 * n8 * t4 + 88.0 * n10 -
              1632.0 * n10 * t2 + 1920.0 * n10 * t4)
        kp = (0.9996) * (1 + (0.5 * (Alon**2) * c2 * k2) +
                         (((Alon**4) / 24.0) * c4 * k4) +
                         (((Alon**6) / 720.0) * c6 * k6))
    else:
        kpsal = None

    posY = None
    if Latitud.getAngulo() > 0:
        posY = "N"
    else:
        posY = "S"

    sal = putm.PuntoUTM(X,
                        Y,
                        hemisferioY=str(posY),
                        helip=AlturaElipsoidal,
                        huso=int(Huso))
    sal.setConvergenciaMeridianos(convmed)
    sal.setEscalaLocalPunto(kpsal)

    return sal
コード例 #7
0
ファイル: PDGeodesia.py プロジェクト: ohisama/pyrinex
    def CalcularLegendre(self,NombreElipsoide):
        '''!
        @brief: Método que cálcula el punto geodesico final.
        @param NombreElipsoide str: Elipsoide de calculo.
        '''
        az=self.__az.getAngulo()
        lat=self.__lat.getAngulo()
        lon=self.__lon.getAngulo()
        s=self.__d
        elipsoide=elip.Elipsoides(NombreElipsoide)
        a=elipsoide.getSemiEjeMayor()
        e1=elipsoide.getPrimeraExcentricidad()
        radios=radcur.RadiosDeCurvatura(NombreElipsoide)
        nhu=radios.getRadioPrimerVertical(lat)
        ro=radios.getRadioElipseMeridiana(lat)
        latsal=lat+\
        ((cos(az)*s)/(ro))-\
        ((s**2/2)*(((3*e1**2*nhu**2*sin(2*lat)*cos(az)**2)/(2*a**2*ro**2))+\
                   ((tan(lat)*sin(az)**2)/(ro*nhu))))+\
        ((s**3/6)*(((3*e1**4*nhu**4*sin(2*lat)**2*cos(az)**3)/(a**4*ro**3))-\
                   ((3*e1**2*nhu**2+cos(2*lat)*cos(az)**3)/(a**2*ro**3))-\
                   ((sin(az)**2*cos(az))/(ro**2*nhu*cos(lat)**2))+\
                   ((5*e1**2*nhu*sin(2*lat)*tan(lat)*sin(az)**2*cos(az))/(a**2*ro**2))-\
                   ((2*tan(lat)**2*cos(az)*sin(az)**2)/(ro*nhu**2))))
#         print(lat)
#         print(latsal)
        
        lonsal=lon+\
        ((s*sin(az))/(ro))+\
        ((s**2/2)*\
         (-((e1**2*nhu*sin(lat))/(a**2*ro))+\
          ((sin(lat))/(nhu*ro*cos(lat)**2))+\
          ((tan(lat))/(nhu**2*cos(lat))))*\
         (sin(az)*cos(az)*s**2))+\
        ((s**3/6)*\
         (((sin(az)*cos(az)**2)/(ro))*\
          (((e1**4*nhu**3*sin(2*lat)*sin(lat))/(a**4*ro))-\
           ((e1**2*nhu*cos(lat))/(a**2*ro))-\
           ((2*e1**2*nhu*sin(2*lat)*sin(lat))/(a**2*ro*cos(lat)**2))+\
           ((2*tan(lat)**2)/(nhu*ro*cos(lat)))+\
           ((1)/(nhu*ro*cos(lat)))-\
           ((e1**2*tan(lat)*sin(2*lat))/(a**2*cos(lat)))+\
           ((1)/(nhu**2*cos(lat)**3))+\
           ((tan(lat)**2)/(nhu**2)))-\
          ((e1**2*nhu*sin(lat)*cos(2*az)*tan(lat)*sin(az))/(a**2*nhu*ro))+\
          ((tan(lat)**2*sin(az)*cos(2*az))/(nhu**2*ro*cos(lat)))+\
          ((tan(lat)**2*sin(az)*cos(2*az))/(nhu**3*cos(lat)))))
        
        #print(lon)
        #print(lonsal)
        
        azsal=az+\
        ((s*tan(lat)*sin(az))/(nhu))+\
        (((nhu**2*sin(az)*cos(az))/(2))*\
         (-((e1**2*nhu*tan(lat)*sin(2*lat))/(2*a**2*ro))+\
          ((1)/(nhu*ro*cos(lat)**2))+\
          ((tan(lat)**2)/(nhu**2))))+\
        (((s**3*cos(2*az)*tan(lat)*sin(az))/(6*nhu))*\
         (-((e1**2*nhu*tan(lat)*sin(2*lat))/(2*a**2*ro))+\
          ((1)/(nhu*ro*cos(lat)**2))+\
          ((tan(lat)**2)/(nhu**2))))+\
        (((s**3*sin(az)*cos(az)**2)/(6*ro))*\
         (((e1**4*nhu**3*tan(lat)*sin(2*lat)**2)/(2*a**4*ro))-\
          ((e1**2*nhu*sin(2*lat))/(2*a**2*ro*cos(lat)**2))-\
          ((2*e1**2*nhu*tan(lat)*cos(2*lat))/(2*a**2*ro))-\
          ((2*e1**2*nhu*sin(2*lat))/(a**2*ro*cos(lat)**2))+\
          ((2*sin(lat))/(nhu*ro*cos(lat)**3))-\
          ((e1**2*sin(2*lat)*tan(lat)**2)/(2*a**2))+\
          ((1)/(nhu**2*cos(lat)**2))))
        
        #print(az)
        #print(azsal)
        
        return latsal,lonsal,azsal
コード例 #8
0
def UTM2Geo(PuntoUTM, NombreElipsoide):
    '''!
    @brief: Método que convierte coordenadas UTM a coordenadas geodeésicas elipsoidales.
    @param PuntoUTM PuntoUTM: Punto con las Coordenadas UTM.
    @param NombreElipsoide str: Nombre del elipsoide de calculo.                           
    @return PuntoGeodesico: PuntoGeodesico con las coordenadas transfromadas.
    '''
    #     print(type(PuntoUTM))
    #     print(putm.PuntoUTM.__class__)
    if not isinstance(PuntoUTM.__class__, putm.PuntoUTM.__class__):
        raise Exception("Valor Punto UTM.")

    try:
        NombreElipsoide = str(NombreElipsoide)
    except:
        raise Exception("Valor Nombre Elipsoide")

    x = PuntoUTM.getX()
    y = PuntoUTM.getY()
    helip = PuntoUTM.getAlturaElipsoidal()
    posY = PuntoUTM.getHemisferioY()
    Huso = PuntoUTM.getHuso()

    Elipsoide = Elip.Elipsoides(NombreElipsoide)
    a = Elipsoide.getSemiEjeMayor()
    e = Elipsoide.getPrimeraExcentricidad()
    e2 = Elipsoide.getSegundaExcentricidad()
    #Calculos auxiliares.
    if posY is "S":
        y = 10000000.0 - y

    x = (x - 500000.0) / 0.9996
    y = y / 0.9996

    #Calculo iterativo de la latitud auxiliar.
    Lat = (y) / (a * (1 - (e**2)))
    Latsig = 0.0
    cont = 0
    while abs(Lat - Latsig) > 0.000000000001:
        if cont != 0:
            Lat = Latsig

        s1 = sin(Lat)
        s3 = (s1**3)
        s5 = (s1**5)
        s7 = (s1**7)
        s9 = (s1**9)
        c1 = cos(Lat)
        g2 = 1.5 * (e**2) * ((-0.5 * s1 * c1) + 0.5 * Lat)
        g3 = (15.0 / 8.0) * (e**4) * ((-0.25 * s3 * c1) -
                                      ((3.0 / 8.0) * s1 * c1) +
                                      ((3.0 / 8.0) * Lat))
        g4 = (35.0 / 16.0) * (e**6) * ((-(1.0 / 6.0) * s5 * c1) -
                                       ((5.0 / 24.0) * s3 * c1) -
                                       ((5.0 / 16.0) * s1 * c1) +
                                       ((5.0 / 16.0) * Lat))
        g5 = (315.0 / 128.0) * (e**8) * ((-(1.0 / 8.0) * s7 * c1) -
                                         ((7.0 / 48.0) * s5 * c1) -
                                         ((35.0 / 192.0) * s3 * c1) -
                                         ((35.0 / 128.0) * s1 * c1) +
                                         ((35.0 / 128.0) * Lat))
        g6 = (693.0 / 256.0) * (e**10) * ((-(1.0 / 10.0) * s9 * c1) -
                                          ((9.0 / 80.0) * s7 * c1) -
                                          ((21.0 / 160.0) * s5 * c1) -
                                          ((21.0 / 128.0) * s3 * c1) -
                                          ((63.0 / 256.0) * s1 * c1) +
                                          ((63.0 / 256.0) * Lat))
        Latsig = (y) / (a * (1 - (e**2))) - (g2 + g3 + g4 + g5 + g6)
        cont += 1

    #Valores Auxiliares
    t = tan(Latsig)
    t2 = (t**2)
    t4 = (t**4)
    t6 = (t**6)
    t8 = (t**8)
    n2 = ((e2**2)) * ((cos(Latsig)**2))
    n4 = (n2**2)
    n6 = (n2**3)
    n8 = (n2**4)
    n10 = (n2**5)
    n12 = (n2**6)
    n14 = (n2**7)
    #Claculo de las series de terminos.
    #Calculo del incremento de longitud.
    #x cubo.
    x3 = (1.0 + 2.0 * t2 + n2)
    #x quinta.
    x5 = (5.0 + 28.0 * t2 + 24.0 * t4 + 6.0 * n2 + 8.0 * n2 * t2 - 3.0 * n4 +
          4.0 * n4 * t2 - 4.0 * n6 + 24.0 * n6 * t2)
    #x septima.
    x7 = (61.0 + 662.0 * t2 + 1320.0 * t4 + 720.0 * t6 + 107.0 * n2 +
          440.0 * n2 * t2 + 336.0 * n2 * t4 + 43.0 * n4 - 234.0 * n4 * t2 -
          192.0 * n4 * t4 + 97.0 * n6 - 772.0 * n6 * t2 + 408.0 * n6 * t4 +
          188.0 * n8 - 2392.0 * n8 * t2 + 1536.0 * n8 * t4 + 88.0 * n10 -
          1632.0 * n10 * t2 + 1920.0 * n10 * t4)
    #x novena.
    x9 = (1385.0 + 24568.0 * t2 + 83664.0 * t4 + 100800.0 * t6 + 40320.0 * t8 +
          3116.0 * n2 + 26736.0 * n2 * t2 + 47808.0 * n2 * t4 +
          24192.0 * n2 * t6 + 1158.0 * n4 - 4884.0 * n4 * t2 -
          20736.0 * n4 * t4 - 13824.0 * n4 * t6 - 3500.0 * n6 +
          27104.0 * n6 * t2 + 576.0 * n6 * t4 + 12192.0 * n6 * t6 -
          11735.0 * n8 + 44788.0 * n8 * t2 - 195984.0 * n8 * t4 +
          9788.0 * n8 * t6 - 20280.0 * n10 + 459312.0 * n12 * t2 -
          1239552.0 * n12 * t4 + 437760.0 * n12 * t6 - 4672.0 * n14 +
          175680.0 * n14 * t2 - 603648.0 * n14 * t4 + 322560.0 * n14 * t6)
    nhu = Rad.RadiosDeCurvatura(NombreElipsoide).getRadioPrimerVertical(Latsig)
    c1 = cos(Latsig)
    Alon = (x / (nhu * c1)) - (((x**3) / (6.0 * (nhu**3) * c1)) * x3) + ((
        (x**5) / (120.0 * (nhu**5) * c1)) * x5) - ((
            (x**7) / (5040.0 * (nhu**7) * c1)) * x7) + (((x**9) /
                                                         (362880.0 *
                                                          (nhu**9) * c1)) * x9)

    lon0 = ang.Angulo((Huso * 6) - 183, formato='longitud180')
    lon0.Convertir('radian')
    Lon = lon0.getAngulo() + Alon
    #Calculo de la Latitud.
    #x cuadrado.
    x2 = (1.0 + n2)
    #x cuarta.
    x4 = (5.0 + 3.0 * t2 + 6.0 * n2 - 6.0 * n2 * t2 - 3.0 * n4 -
          9.0 * n4 * t2 - 4.0 * n6)
    #x sexta.
    x6 = (61.0 + 90.0 * t2 + 45.0 * t4 + 107.0 * n2 - 162.0 * n2 * t2 -
          45.0 * n2 * t4 + 43.0 * n4 - 318.0 * n4 * t2 + 135.0 * n4 * t4 +
          97.0 * n6 + 18.0 * n6 * t2 + 225.0 * n6 * t4)
    #x octava.
    x8 = (1385.0 + 3633.0 * t2 + 4515.0 * t4 + 2310.0 * t4 + 3116.0 * n2 -
          5748.0 * n2 * t2 + 4704.0 * n2 * t4 - 525.0 * n2 * t6 + 1158.0 * n4 -
          17826.0 * n4 * t2 + 37734.0 * n4 * t4 - 9450.0 * n4 * t6 -
          3500.0 * n6 + 1164.0 * n6 * t2 + 14006.0 * n6 * t4 -
          20790.0 * n6 * t6 - 11735.0 * n8 + 29001.0 * n8 * t2 +
          13389.0 * n8 * t4 - 45.0 * n8 * t6 - 20280.0 * n10 +
          64272.0 * n10 * t2 - 15864.0 * n10 * t4 - 16144.0 * n12 +
          75408.0 * n12 * t2 - 31872.0 * n12 * t4 - 4672.0 * n14 +
          30528.0 * n14 * t2 - 23040.0 * n14 * t4)

    Lats = Latsig + (((-(x**2) / (2.0 * (nhu**2))) * t * x2) +
                     ((((x**4) / (24.0 * (nhu**4))) * t * x4)) -
                     ((((x**6) / (720.0 * (nhu**6))) * t * x6)) +
                     ((((-x**8) / (40320.0 * (nhu**8))) * t * x8)))

    #Cálculo de la convergencia de meridianos.
    #coeficientes.
    s1 = sin(Lats)
    c1 = cos(Lats)
    c2 = (c1**2)
    c4 = (c1**4)
    c6 = (c1**6)
    t = tan(Lats)
    t2 = (t**2)
    t4 = (t**4)
    t6 = (t**6)
    t8 = (t**8)
    n2 = ((e2**2)) * ((cos(Lats)**2))
    n4 = (n2**2)
    n6 = (n2**3)
    n8 = (n2**4)
    n10 = (n2**5)
    n12 = (n2**6)
    n14 = (n2**7)
    m3 = (1.0 + 3.0 * n2 + 2 * n4)
    m5 = (2.0 - t2 + 15.0 * n2 * t2 + 35.0 * n4 - 50.0 * n4 * t2 + 33.0 * n6 -
          60.0 * n6 * t2 + 11.0 * n8 - 24.0 * n8 * t2)
    m7 = (-148.0 - 3427.0 * t2 + 18.0 * t4 - 1387.0 * t6 + 2023.0 * n2 -
          46116.0 * n2 * t2 + 5166.0 * n2 * t4 + 18984.0 * n4 -
          100212.0 * n4 * t4 + 34783 * n6 - 219968.0 * n6 * t2 +
          144900.0 * n6 * t4 + 36180.0 * n8 - 261508.0 * n8 * t2 +
          155904.0 * n8 * t4 + 18472.0 * n10 - 114528.0 * n10 * t2 +
          94080.0 * n10 * t4 + 4672.0 * n12 - 30528.0 * n12 * t2 +
          23040.0 * n12 * t4)
    convmed = (Alon * s1) + (((Alon**3) / 3.0) * s1 * c2 * m3) + ((
        (Alon**5) / 15.0) * s1 * c4 * m5) + ((
            (Alon**7) / 5040.0) * s1 * c6 * m7)
    convmed = ang.Angulo(convmed, formato='radian')
    convmed.Convertir('pseudosexagesimal')
    convmed = convmed.getAngulo()
    #Calculo de la escala local del punto.
    #coeficientes.
    k2 = (1 + n2)
    k4 = (5.0 - 4.0 * t2 + 14.0 * n2 - 28.0 * n2 * t2 + 13.0 * n4 -
          48.0 * n4 * t2 + 4.0 * n6 - 24.0 * n6 * t2)
    k6 = (61.0 + 10636.0 * t2 - 9136.0 * t4 + 224.0 * t6 + 331.0 * n2 +
          44432.0 * n2 * t2 - 50058.0 * n2 * t4 - 715.0 * n4 +
          68100.0 * n4 * t2 - 95680.0 * n4 * t4 + 769.0 * n6 +
          43816.0 * n6 * t2 - 80160.0 * n6 * t4 + 412.0 * n8 +
          9644.0 * n8 * t2 - 21888.0 * n8 * t4 + 88.0 * n10 -
          1632.0 * n10 * t2 + 1920.0 * n10 * t4)
    kp = (0.9996) * (1 + (0.5 * (Alon**2) * c2 * k2) +
                     (((Alon**4) / 24.0) * c4 * k4) +
                     (((Alon**6) / 720.0) * c6 * k6))
    #kp=sqrt(kp)

    Lats = ang.Angulo(Lats, formato='radian')
    Lats.Convertir('latitud')
    Lats = Lats.getAngulo()

    Lon = ang.Angulo(Lon, formato='radian')
    Lon.Convertir('longitud180')
    Lon = Lon.getAngulo()

    p1 = pgeo.PuntoGeodesico(Lats, Lon, helip)
    PuntoUTM.setConvergenciaMeridianos(convmed)
    PuntoUTM.setEscalaLocalPunto(kp)

    return p1