coordconverterVMN 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- coordconvertervmn-0.1.0/LICENSE +0 -0
- coordconvertervmn-0.1.0/PKG-INFO +122 -0
- coordconvertervmn-0.1.0/README.md +109 -0
- coordconvertervmn-0.1.0/pyproject.toml +23 -0
- coordconvertervmn-0.1.0/setup.cfg +4 -0
- coordconvertervmn-0.1.0/src/coordconverterVMN/_init_.py +1 -0
- coordconvertervmn-0.1.0/src/coordconverterVMN/coordconverterVMN.py +52 -0
- coordconvertervmn-0.1.0/src/coordconverterVMN.egg-info/PKG-INFO +122 -0
- coordconvertervmn-0.1.0/src/coordconverterVMN.egg-info/SOURCES.txt +9 -0
- coordconvertervmn-0.1.0/src/coordconverterVMN.egg-info/dependency_links.txt +1 -0
- coordconvertervmn-0.1.0/src/coordconverterVMN.egg-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: coordconverterVMN
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python package for converting Decimal Degrees and Geographic Coordinates.
|
|
5
|
+
Author-email: Vitumbiko Masuti Nyirongo <masutinyirongo@gmail.com>
|
|
6
|
+
Keywords: GIS,coordinates,geospatial,decimal-degrees,DMS,coordinate-conversion
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# Coordinate Converter
|
|
15
|
+
|
|
16
|
+
A lightweight Python package for converting geographic coordinates between **Decimal Degrees (DD)** and **Degrees, Minutes, Seconds (DMS)**.
|
|
17
|
+
|
|
18
|
+
The package provides two main functions: `to_degrees()` and `to_decimal()`, making coordinate conversion simple and convenient for GIS, surveying, cartography, and geospatial applications.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- Convert Decimal Degrees to Geographic Coordinates (DMS).
|
|
23
|
+
- Convert Geographic Coordinates (DMS) to Decimal Degrees.
|
|
24
|
+
- Automatically determine hemisphere directions (N, S, E, W).
|
|
25
|
+
- Support negative coordinates.
|
|
26
|
+
- Validate minutes, seconds, and direction inputs.
|
|
27
|
+
- Round DMS seconds to 4 decimal places.
|
|
28
|
+
- Display Decimal Degrees results to 3 decimal places.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
Install the package using pip:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install coordconverterVMN
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### 1. Decimal Degrees to Geographic Coordinates
|
|
41
|
+
|
|
42
|
+
Use `to_degrees(latitude, longitude)` to convert Decimal Degrees into DMS coordinates.
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from coordconverterVMN import to_degrees
|
|
46
|
+
|
|
47
|
+
to_degrees(-15.7864, 35.0052)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Output:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
CONVERTING DECIMAL DEGREES TO GEOGRAPHIC COORDINATES
|
|
54
|
+
Geographic Coordinates: (15, 47, 11.04, 'S'), (35, 0, 18.72, 'E')
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The function automatically determines the appropriate hemisphere based on the sign of each coordinate.
|
|
58
|
+
|
|
59
|
+
### 2. Geographic Coordinates to Decimal Degrees
|
|
60
|
+
|
|
61
|
+
Use `to_decimal(latitude, longitude)` to convert DMS coordinates into Decimal Degrees.
|
|
62
|
+
|
|
63
|
+
Each coordinate must be supplied as:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
(degrees, minutes, seconds, direction)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Example:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from coordconverterVMN import to_decimal
|
|
73
|
+
|
|
74
|
+
to_decimal((15, 47, 11.04, "S"), (35, 0, 18.72, "E"))
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Output:
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
CONVERTING GEOGRAPHIC COORDINATES TO DECIMAL DEGREES
|
|
81
|
+
Decimal Degrees: (-15.786, 35.005)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The function supports the following directions:
|
|
85
|
+
|
|
86
|
+
| Direction | Hemisphere |
|
|
87
|
+
|---|---|
|
|
88
|
+
| N | North |
|
|
89
|
+
| S | South |
|
|
90
|
+
| E | East |
|
|
91
|
+
| W | West |
|
|
92
|
+
|
|
93
|
+
## Error Handling
|
|
94
|
+
|
|
95
|
+
The package raises `ValueError` when:
|
|
96
|
+
|
|
97
|
+
- Minutes are less than 0 or greater than or equal to 60.
|
|
98
|
+
- Seconds are less than 0 or greater than or equal to 60.
|
|
99
|
+
- An invalid direction is supplied.
|
|
100
|
+
|
|
101
|
+
## Applications
|
|
102
|
+
|
|
103
|
+
This package can be used in:
|
|
104
|
+
|
|
105
|
+
- Geographic Information Systems (GIS)
|
|
106
|
+
- GPS coordinate processing
|
|
107
|
+
- Surveying and mapping
|
|
108
|
+
- Geospatial data analysis
|
|
109
|
+
- Geographic coordinate manipulation
|
|
110
|
+
|
|
111
|
+
## Contributing
|
|
112
|
+
|
|
113
|
+
Contributions, suggestions, and bug reports are welcome.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
This project is licensed under the MIT License.
|
|
118
|
+
|
|
119
|
+
## Author
|
|
120
|
+
|
|
121
|
+
Developed by **VITUMBIKO MASUTI NYIRONGO, GIS**.
|
|
122
|
+
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Coordinate Converter
|
|
2
|
+
|
|
3
|
+
A lightweight Python package for converting geographic coordinates between **Decimal Degrees (DD)** and **Degrees, Minutes, Seconds (DMS)**.
|
|
4
|
+
|
|
5
|
+
The package provides two main functions: `to_degrees()` and `to_decimal()`, making coordinate conversion simple and convenient for GIS, surveying, cartography, and geospatial applications.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Convert Decimal Degrees to Geographic Coordinates (DMS).
|
|
10
|
+
- Convert Geographic Coordinates (DMS) to Decimal Degrees.
|
|
11
|
+
- Automatically determine hemisphere directions (N, S, E, W).
|
|
12
|
+
- Support negative coordinates.
|
|
13
|
+
- Validate minutes, seconds, and direction inputs.
|
|
14
|
+
- Round DMS seconds to 4 decimal places.
|
|
15
|
+
- Display Decimal Degrees results to 3 decimal places.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install the package using pip:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install coordconverterVMN
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### 1. Decimal Degrees to Geographic Coordinates
|
|
28
|
+
|
|
29
|
+
Use `to_degrees(latitude, longitude)` to convert Decimal Degrees into DMS coordinates.
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from coordconverterVMN import to_degrees
|
|
33
|
+
|
|
34
|
+
to_degrees(-15.7864, 35.0052)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Output:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
CONVERTING DECIMAL DEGREES TO GEOGRAPHIC COORDINATES
|
|
41
|
+
Geographic Coordinates: (15, 47, 11.04, 'S'), (35, 0, 18.72, 'E')
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The function automatically determines the appropriate hemisphere based on the sign of each coordinate.
|
|
45
|
+
|
|
46
|
+
### 2. Geographic Coordinates to Decimal Degrees
|
|
47
|
+
|
|
48
|
+
Use `to_decimal(latitude, longitude)` to convert DMS coordinates into Decimal Degrees.
|
|
49
|
+
|
|
50
|
+
Each coordinate must be supplied as:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
(degrees, minutes, seconds, direction)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Example:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from coordconverterVMN import to_decimal
|
|
60
|
+
|
|
61
|
+
to_decimal((15, 47, 11.04, "S"), (35, 0, 18.72, "E"))
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Output:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
CONVERTING GEOGRAPHIC COORDINATES TO DECIMAL DEGREES
|
|
68
|
+
Decimal Degrees: (-15.786, 35.005)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The function supports the following directions:
|
|
72
|
+
|
|
73
|
+
| Direction | Hemisphere |
|
|
74
|
+
|---|---|
|
|
75
|
+
| N | North |
|
|
76
|
+
| S | South |
|
|
77
|
+
| E | East |
|
|
78
|
+
| W | West |
|
|
79
|
+
|
|
80
|
+
## Error Handling
|
|
81
|
+
|
|
82
|
+
The package raises `ValueError` when:
|
|
83
|
+
|
|
84
|
+
- Minutes are less than 0 or greater than or equal to 60.
|
|
85
|
+
- Seconds are less than 0 or greater than or equal to 60.
|
|
86
|
+
- An invalid direction is supplied.
|
|
87
|
+
|
|
88
|
+
## Applications
|
|
89
|
+
|
|
90
|
+
This package can be used in:
|
|
91
|
+
|
|
92
|
+
- Geographic Information Systems (GIS)
|
|
93
|
+
- GPS coordinate processing
|
|
94
|
+
- Surveying and mapping
|
|
95
|
+
- Geospatial data analysis
|
|
96
|
+
- Geographic coordinate manipulation
|
|
97
|
+
|
|
98
|
+
## Contributing
|
|
99
|
+
|
|
100
|
+
Contributions, suggestions, and bug reports are welcome.
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
This project is licensed under the MIT License.
|
|
105
|
+
|
|
106
|
+
## Author
|
|
107
|
+
|
|
108
|
+
Developed by **VITUMBIKO MASUTI NYIRONGO, GIS**.
|
|
109
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
[project]
|
|
5
|
+
name = "coordconverterVMN"
|
|
6
|
+
version = "0.1.0"
|
|
7
|
+
description = "A Python package for converting Decimal Degrees and Geographic Coordinates."
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.8"
|
|
10
|
+
license = { file="LICENSE" }
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Vitumbiko Masuti Nyirongo", email = "masutinyirongo@gmail.com" }
|
|
13
|
+
]
|
|
14
|
+
keywords = [ "GIS",
|
|
15
|
+
"coordinates",
|
|
16
|
+
"geospatial",
|
|
17
|
+
"decimal-degrees",
|
|
18
|
+
"DMS",
|
|
19
|
+
"coordinate-conversion"]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Operating System :: OS Independent"
|
|
23
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__all__=[" to_decimal","to_degrees"]
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
def to_degrees(latitude, longitude):
|
|
3
|
+
print("CONVERTING DECIMAL DEGREES TO GEOGRAPHIC COORDINATES")
|
|
4
|
+
|
|
5
|
+
def convert(value, is_latitude):
|
|
6
|
+
direction = "N" if is_latitude else "E"
|
|
7
|
+
|
|
8
|
+
if value < 0:
|
|
9
|
+
direction = "S" if is_latitude else "W"
|
|
10
|
+
|
|
11
|
+
value = abs(value)
|
|
12
|
+
|
|
13
|
+
degrees = int(value)
|
|
14
|
+
minutes_decimal = (value - degrees) * 60
|
|
15
|
+
minutes = int(minutes_decimal)
|
|
16
|
+
seconds = (minutes_decimal - minutes) * 60
|
|
17
|
+
|
|
18
|
+
return degrees, minutes, round(seconds, 4), direction
|
|
19
|
+
|
|
20
|
+
lat_dms = convert(latitude, True)
|
|
21
|
+
lon_dms = convert(longitude, False)
|
|
22
|
+
|
|
23
|
+
result_formart=print(f"Geographic Coordinates: {lat_dms}, {lon_dms}")
|
|
24
|
+
return result_formart
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def to_decimal(latitude, longitude):
|
|
29
|
+
print("CONVERTING GEOGRAPHIC COORDINATES TO DECIMAL DEGREES")
|
|
30
|
+
|
|
31
|
+
def convert(degrees, minutes, seconds, direction):
|
|
32
|
+
direction = direction.upper()
|
|
33
|
+
|
|
34
|
+
if minutes < 0 or minutes >= 60 or seconds < 0 or seconds >= 60:
|
|
35
|
+
raise ValueError("Minutes and seconds must be between 0 and 60.")
|
|
36
|
+
|
|
37
|
+
if direction not in ("N", "S", "E", "W"):
|
|
38
|
+
raise ValueError("Direction must be N, S, E, or W.")
|
|
39
|
+
|
|
40
|
+
decimal_degrees = abs(degrees) + minutes / 60 + seconds / 3600
|
|
41
|
+
|
|
42
|
+
if direction in ("S", "W"):
|
|
43
|
+
decimal_degrees = -decimal_degrees
|
|
44
|
+
|
|
45
|
+
return decimal_degrees
|
|
46
|
+
|
|
47
|
+
lat_dd = convert(*latitude)
|
|
48
|
+
lon_dd = convert(*longitude)
|
|
49
|
+
|
|
50
|
+
result_format=print(f"Decimal Degrees: ({lat_dd:.3f}, {lon_dd:.3f})")
|
|
51
|
+
return result_format
|
|
52
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: coordconverterVMN
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python package for converting Decimal Degrees and Geographic Coordinates.
|
|
5
|
+
Author-email: Vitumbiko Masuti Nyirongo <masutinyirongo@gmail.com>
|
|
6
|
+
Keywords: GIS,coordinates,geospatial,decimal-degrees,DMS,coordinate-conversion
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# Coordinate Converter
|
|
15
|
+
|
|
16
|
+
A lightweight Python package for converting geographic coordinates between **Decimal Degrees (DD)** and **Degrees, Minutes, Seconds (DMS)**.
|
|
17
|
+
|
|
18
|
+
The package provides two main functions: `to_degrees()` and `to_decimal()`, making coordinate conversion simple and convenient for GIS, surveying, cartography, and geospatial applications.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- Convert Decimal Degrees to Geographic Coordinates (DMS).
|
|
23
|
+
- Convert Geographic Coordinates (DMS) to Decimal Degrees.
|
|
24
|
+
- Automatically determine hemisphere directions (N, S, E, W).
|
|
25
|
+
- Support negative coordinates.
|
|
26
|
+
- Validate minutes, seconds, and direction inputs.
|
|
27
|
+
- Round DMS seconds to 4 decimal places.
|
|
28
|
+
- Display Decimal Degrees results to 3 decimal places.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
Install the package using pip:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install coordconverterVMN
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### 1. Decimal Degrees to Geographic Coordinates
|
|
41
|
+
|
|
42
|
+
Use `to_degrees(latitude, longitude)` to convert Decimal Degrees into DMS coordinates.
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from coordconverterVMN import to_degrees
|
|
46
|
+
|
|
47
|
+
to_degrees(-15.7864, 35.0052)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Output:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
CONVERTING DECIMAL DEGREES TO GEOGRAPHIC COORDINATES
|
|
54
|
+
Geographic Coordinates: (15, 47, 11.04, 'S'), (35, 0, 18.72, 'E')
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The function automatically determines the appropriate hemisphere based on the sign of each coordinate.
|
|
58
|
+
|
|
59
|
+
### 2. Geographic Coordinates to Decimal Degrees
|
|
60
|
+
|
|
61
|
+
Use `to_decimal(latitude, longitude)` to convert DMS coordinates into Decimal Degrees.
|
|
62
|
+
|
|
63
|
+
Each coordinate must be supplied as:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
(degrees, minutes, seconds, direction)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Example:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from coordconverterVMN import to_decimal
|
|
73
|
+
|
|
74
|
+
to_decimal((15, 47, 11.04, "S"), (35, 0, 18.72, "E"))
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Output:
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
CONVERTING GEOGRAPHIC COORDINATES TO DECIMAL DEGREES
|
|
81
|
+
Decimal Degrees: (-15.786, 35.005)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The function supports the following directions:
|
|
85
|
+
|
|
86
|
+
| Direction | Hemisphere |
|
|
87
|
+
|---|---|
|
|
88
|
+
| N | North |
|
|
89
|
+
| S | South |
|
|
90
|
+
| E | East |
|
|
91
|
+
| W | West |
|
|
92
|
+
|
|
93
|
+
## Error Handling
|
|
94
|
+
|
|
95
|
+
The package raises `ValueError` when:
|
|
96
|
+
|
|
97
|
+
- Minutes are less than 0 or greater than or equal to 60.
|
|
98
|
+
- Seconds are less than 0 or greater than or equal to 60.
|
|
99
|
+
- An invalid direction is supplied.
|
|
100
|
+
|
|
101
|
+
## Applications
|
|
102
|
+
|
|
103
|
+
This package can be used in:
|
|
104
|
+
|
|
105
|
+
- Geographic Information Systems (GIS)
|
|
106
|
+
- GPS coordinate processing
|
|
107
|
+
- Surveying and mapping
|
|
108
|
+
- Geospatial data analysis
|
|
109
|
+
- Geographic coordinate manipulation
|
|
110
|
+
|
|
111
|
+
## Contributing
|
|
112
|
+
|
|
113
|
+
Contributions, suggestions, and bug reports are welcome.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
This project is licensed under the MIT License.
|
|
118
|
+
|
|
119
|
+
## Author
|
|
120
|
+
|
|
121
|
+
Developed by **VITUMBIKO MASUTI NYIRONGO, GIS**.
|
|
122
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/coordconverterVMN/_init_.py
|
|
5
|
+
src/coordconverterVMN/coordconverterVMN.py
|
|
6
|
+
src/coordconverterVMN.egg-info/PKG-INFO
|
|
7
|
+
src/coordconverterVMN.egg-info/SOURCES.txt
|
|
8
|
+
src/coordconverterVMN.egg-info/dependency_links.txt
|
|
9
|
+
src/coordconverterVMN.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
coordconverterVMN
|