Skip to content

Commit

Permalink
Add longitude and latitude to conical converter (#329)
Browse files Browse the repository at this point in the history
* Create lonlat_converter_lambert.py

* Create readme.md

* Rename Longitude Latitude conical converter/Python/lonlat_converter_lambert.py to Longitude Latitude conical converter/lonlat_converter_lambert.py

* Rename Longitude Latitude conical converter/Python/readme.md to Longitude Latitude conical converter/readme.md

* Update README.md
  • Loading branch information
bibliofilo authored Oct 13, 2024
1 parent 0073d35 commit 66161ee
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Longitude Latitude conical converter/lonlat_converter_lambert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from pyproj import Proj
from shapely.geometry import Point
from shapely.geometry.polygon import Polygon

# Definition of lambert conical projection.
lambert = {'proj': 'lcc', # Lambert Conformal Conic 2SP (epsg:9802)
'ellps': 'GRS80', #'epsg:7019', #'epsg:9802', # 'epsg:6651',
'lon_0': -102.00000000,
'lat_0': 12.00000000, # 12° 00’ 0.0’’ N
'lat_1': 17.50000000, # 17° 30’ 0.00’’ N
'lat_2': 29.50000000, # 29° 30’ 0.00’’ N
'x_0': 2500000,
'y_0': 0}

prj = Proj(lambert)

# Coordinates for the city of Monterrey, Nuevo León, México

city = {'c_name': 'Monterrey', 'lon': -100.316116, 'lat': 25.686613}

x, y = prj(city['lon'], city['lat'])

print(' X Y')
print(city['c_name'], ': lon:', city['lon'], ' , lat:', city['lat'])
print('Lambert function:', x, ',', y)
print(' Should return: 2668223.843 , 1516271.922')

# Should return:

"""
X Y
Monterrey : lon: -100.316116 , lat: 25.686613
Lambert function: 2668223.842598227 , 1516271.9216458194
Should return: 2668223.843 , 1516271.922
"""
21 changes: 21 additions & 0 deletions Longitude Latitude conical converter/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Longitude and Latitude to Conical Converter

This script converts longitude and latitude to [Lambert conformal conic projection](https://en.wikipedia.org/wiki/Lambert_conformal_conic_projection).
The example used is for Mexico, under International Terrestrial Reference Frame 2008, which uses Lambert Conformal Conic projection 2SP (epsg:9802).

This script is useful to combine census and geographic data, with traditional Longitude and Latitude from the more international frame of reference.

For more reference, see [National Geography institute explanatory PDF](https://www.inegi.org.mx/contenidos/temas/MapaDigital/Doc/asignar_sistema_coordenadas.pdf)
and [Pyproj, Lambert projections](https://proj.org/operations/projections/lcc.html).

## Prerequisites
- Python 3.x installed on your machine.

## Dependencies
The script requires the following Python libraries:
`pyproj`
`shapely`

You can install the required library using pip:
`pip install pyproj`
`pip install shapely`
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ More information on contributing and the general code of conduct for discussion
| Keylogger | [Keylogger](https://github.com/DhanushNehru/Python-Scripts/tree/master/Keylogger) | Keylogger that can track your keystrokes, clipboard text, take screenshots at regular intervals, and records audio. |
| Keyword - Retweeting | [Keyword - Retweeting](https://github.com/DhanushNehru/Python-Scripts/tree/master/Keyword%20Retweet%20Twitter%20Bot) | Find the latest tweets containing given keywords and then retweet them. |
| LinkedIn Bot | [LinkedIn Bot](https://github.com/DhanushNehru/Python-Scripts/tree/master/LinkedIn%20Bot) | Automates the process of searching for public profiles on LinkedIn and exporting the data to an Excel sheet. |
| Longitude & Latitude to conical coverter | [Longitude Latitude conical converter](master/Longitude%20Latitude%20conical%20converter) | Converts Longitude and Latitude to Lambert conformal conic projection. |
| Mail Sender | [Mail Sender](https://github.com/DhanushNehru/Python-Scripts/tree/master/Mail%20Sender) | Sends an email. |
| Merge Two Images | [Merge Two Images](https://github.com/DhanushNehru/Python-Scripts/tree/master/Merge%20Two%20Images) | Merges two images horizontally or vertically. |
| Mouse mover | [Mouse mover](https://github.com/DhanushNehru/Python-Scripts/tree/master/Mouse%20Mover) | Moves your mouse every 15 seconds. |
Expand Down

0 comments on commit 66161ee

Please sign in to comment.