Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

convertion coordonnees séxagécimale en VB

francisko02

XLDnaute Nouveau
bonjour,

j'ai dans un fichier excel des coordonnees séxagécimale c'est à dire degré minute seconde.

Je voudrais affiché le résultat du code ci dessous dans la cellule qui correspond a sa ligne d'enregistrement . Merci

en VB access coordonnées rentrer sous un formulaire:

Option Compare Database

Private Sub long_sw_LostFocus()
Dim Coord1 As String, Coord2 As String, Coord3 As String, Coord4 As String, Coord5 As String, Coord6 As String, Coord7 As String, Coord8 As String
' Latitude Nord Ouest
Coord1 = (Mid(lat_nw, 3, 2) + (Mid(lat_nw, 5, 2) / 60) + (Mid(lat_nw, 7, 2) / 3600))
If Left(lat_nw, 1) = "N" Then
Coord1 = Round(Coord1 * 111319.5)
Else
Coord1 = Round(Coord1 * -111319.5)
End If
' Longitude Nord Ouest
Coord2 = (Mid(long_nw, 2, 3) + (Mid(long_nw, 5, 2) / 60) + (Mid(long_nw, 7, 2) / 3600))
If Left(long_nw, 1) = "E" Then
Coord2 = Round(Coord2 * 111319.5)
Else
Coord2 = Round(Coord2 * -111319.5)
End If
' Latitude Nord Est
Coord3 = (Mid(lat_ne, 3, 2) + (Mid(lat_ne, 5, 2) / 60) + (Mid(lat_ne, 7, 2) / 3600))
If Left(lat_ne, 1) = "N" Then
Coord3 = Round(Coord3 * 111319.5)
Else
Coord3 = Round(Coord3 * -111319.5)
End If
' Longitude Nord Est
Coord4 = (Mid(long_ne, 2, 3) + (Mid(long_ne, 5, 2) / 60) + (Mid(long_ne, 7, 2) / 3600))
If Left(long_ne, 1) = "E" Then
Coord4 = Round(Coord4 * 111319.5)
Else
Coord4 = Round(Coord4 * -111319.5)
End If
' Latitude Sud Est
Coord5 = (Mid(lat_se, 3, 2) + (Mid(lat_se, 5, 2) / 60) + (Mid(lat_se, 7, 2) / 3600))
If Left(lat_se, 1) = "N" Then
Coord5 = Round(Coord5 * 111319.5)
Else
Coord5 = Round(Coord5 * -111319.5)
End If
' Longitude Sud Est
Coord6 = (Mid(long_se, 2, 3) + (Mid(long_se, 5, 2) / 60) + (Mid(long_se, 7, 2) / 3600))
If Left(long_se, 1) = "E" Then
Coord6 = Round(Coord6 * 111319.5)
Else
Coord6 = Round(Coord6 * -111319.5)
End If
' Latitude Sud Ouest
Coord7 = (Mid(lat_sw, 3, 2) + (Mid(lat_sw, 5, 2) / 60) + (Mid(lat_sw, 7, 2) / 3600))
If Left(lat_sw, 1) = "N" Then
Coord7 = Round(Coord7 * 111319.5)
Else
Coord7 = Round(Coord7 * -111319.5)
End If
' Longitude Sud Ouest
Coord8 = (Mid(long_sw, 2, 3) + (Mid(long_sw, 5, 2) / 60) + (Mid(long_sw, 7, 2) / 3600))
If Left(long_sw, 1) = "E" Then
Coord8 = Round(Coord8 * 111319.5)
Else
Coord8 = Round(Coord8 * -111319.5)
End If
' Ecrit dans le champ coordonée
geoconcept = "1;4;2;0;1;(4;(" & Coord2 & ";" & Coord1 * 1 & ");(" & Coord4 & ";" & Coord3 & ");(" & Coord6 & ";" & Coord5 & ");(" & Coord8 & ";" & Coord7 & "))"


End Sub
 

Pièces jointes

  • fichier excel.zip
    37.5 KB · Affichages: 33
  • fichier excel.zip
    37.5 KB · Affichages: 21
  • fichier excel.zip
    37.5 KB · Affichages: 21

Discussions similaires

Réponses
4
Affichages
337
Réponses
3
Affichages
143
Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…