diff --git a/Longitude Latitude conical converter/lonlat_converter_lambert.py b/Longitude Latitude conical converter/lonlat_converter_lambert.py new file mode 100644 index 0000000..fb8371e --- /dev/null +++ b/Longitude Latitude conical converter/lonlat_converter_lambert.py @@ -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 +""" diff --git a/Longitude Latitude conical converter/readme.md b/Longitude Latitude conical converter/readme.md new file mode 100644 index 0000000..a22092a --- /dev/null +++ b/Longitude Latitude conical converter/readme.md @@ -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` diff --git a/README.md b/README.md index 94f4246..2666698 100644 --- a/README.md +++ b/README.md @@ -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. |