{ "info": { "author": "Lee Ji-ho", "author_email": "search5@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering" ], "description": "#### Features\nMethods for representing geographic coordinates (latitude and longitude) including the ability to:\n\n> * Convert lat/lon strings from almost any format into a LatLon object (analogous to the datetime library\u2019s stptime method)\n> * Automatically store decimal degrees, decimal minutes, and degree, minute, second information in a LatLon object\n> * Output lat/lon information into a formatted string (analogous to the datetime library\u2019s strftime method)\n> * Project lat/lon coordinates into some other proj projection\n> * Calculate distance and heading between lat/lon pairs using either the FAI or WGS84 approximation\n> * Create a new LatLon object by offsetting an initial coordinate by a distance and heading\n> * Subtracting one LatLon object from another creates a GeoVector object with distance and heading attributes (analogous to the datetime library\u2019s timedelta object)\n> * Adding or subtracting a Latlon object and a GeoVector object creates a new LatLon object with the coordinates adjusted by the GeoVector object\u2019s distance and heading\n> * GeoVector objects can be added, subtracted, multiplied or divided\n\n#### Installation\nLatLon has only been tested in Python 2.7, 3.6\n\nInstallation through pip:\n\n```bash\n$ pip install LatLon\n```\n\nRequires the following non-standard libraries:\n\n> * pyproj\n\n#### Usage Notes\nUsage of LatLon is primarily through the class LatLon, which is designed to hold a single pair of Latitude and Longitude objects. Strings can be converted to LatLon objects using the method string2latlon, and to Latitude or Longitude objects using string2geocoord. Alternatively, a LatLon object can be constructed by subtracting two LatLon objects, or adding or subtracting a Latlon object and a GeoVector object.\n\n##### Latitude or Longitude Construction\nLatitude of longitude construction is through the classes Latitude and Longitude, respectively. You can pass a latitude or longitude coordinate in any combination of decimal degrees, degrees and minutes, or degrees minutes and seconds. Alternatively, you can pass a formatted string using the function string2geocoord for a string containing a single latitude or longitude, or string2latlon for a pair of strings representing the latitude and longitude.\n\n##### String formatting:\nstring2latlon and string2geocoord both take a formatter string which is loosely modeled on the format keyword used in datetime\u2019s strftime function. Indicator characters (e.g. H or D) are placed between a specific separator character (%) to specify the way in which a coordinate string is formatted. Possible values are as follows:\n\n> * H is a hemisphere identifier (e.g. N, S, E or W)\n> * D is a coordinate in decimal degrees notation (e.g. 5.833)\n> * d is a coordinate in degrees notation (e.g. 5)\n> * M is a coordinate in decimal minutes notation (e.g. 54.35)\n> * m is a coordinate in minutes notation (e.g. 54)\n> * S is a coordinate in seconds notation (e.g. 28.93)\n> * Any other characters (e.g. \u2018 \u2018 or \u2018, \u2018) will be treated as a separator between the above components.\n> * All components should be separated by the % character. For example, if the coord_str is \u20185, 52, 59.88_N\u2019, the format_str would be \u2018d%, %m%, %S%_%H\u2019\n\n##### Important\nOne format that will not currently work is one where the hemisphere identifier and a degree or decimal degree are not separated by any characters. For example \u20185 52 59.88 N\u2019 is valid whereas \u20185 52 59.88N\u2019 is not.\n\n##### String output:\nBoth LatLon and Latitude and Longitude objects include a to_string() method for outputting a formatted coordinate.\n\n##### Projection:\nUse LatLon.project to transform geographical coordinates into a chosen projection. Requires that you pass it a pyproj or basemap projection.\n\n##### Distance and Heading Calculation:\nLatLon objects have a distance() method which accepts a 2nd LatLon object as an argument. distance() will calculate the great-circle distance between the two coordinates using the WGS84 ellipsoid by default. To use the more approximate FAI sphere, set ellipse to \u2018sphere\u2019. Initial and reverse headings (in degrees) can be calculated in a similar way using the heading_initial() and heading_reverse() methods. Alternatively, subtracting one LatLon object from another will return a GeoVector object with the attributes heading and distance.\n\n##### Creating a New LatLon Object by Offset from Another One:\nUse the offset() method of LatLon objects, which takes an initial heading (in degrees) and distance (in km) to return a new LatLon object at the offset coordinates. Also, you can perform the same operation by adding or subtracting a LatLon object with a GeoVector object.\n\n#### Examples\nCreate a LatLon object from coordinates:\n\n```python\n>> palmyra = LatLon(Latitude(5.8833), Longitude(-162.0833)) # Location of Palmyra Atoll in decimal degrees\n>> palmyra = LatLon(5.8833, -162.0833) # Same thing but simpler!\n>> palmyra = LatLon(Latitude(degree = 5, minute = 52, second = 59.88),\n>> Longitude(degree = -162, minute = -4.998) # or more complicated!\n>> print(palmyra.to_string('d% %m% %S% %H')) # Print coordinates to degree minute second\n('5 52 59.88 N', '162 4 59.88 W')\n```\n\nCreate a Latlon object from a formatted string:\n\n```python\n>> palmyra = string2latlon('5 52 59.88 N', '162 4 59.88 W', 'd% %m% %S% %H')\n>> print(palmyra.to_string('d%_%M')) # Print coordinates as degree minutes separated by underscore\n('5_52.998', '-162_4.998')\n```\n\nPerform some calculations:\n\n```python\n>> palmyra = LatLon(Latitude(5.8833), Longitude(-162.0833)) # Location of Palmyra Atoll\n>> honolulu = LatLon(Latitude(21.3), Longitude(-157.8167)) # Location of Honolulu, HI\n>> distance = palmyra.distance(honolulu) # WGS84 distance in km\n>> print distance\n1766.69130376\n>> print(palmyra.distance(honolulu, ellipse = 'sphere')) # FAI distance in km\n1774.77188181\n>> initial_heading = palmyra.heading_initial(honolulu) # Heading from Palmyra to Honolulu on WGS84 ellipsoid\n>> print(initial_heading)\n14.6907922022\n>> hnl = palmyra.offset(initial_heading, distance) # Reconstruct Honolulu based on offset from Palmyra\n>> print(hnl.to_string('D')) # Coordinates of Honolulu\n('21.3', '-157.8167')\n```\n\nManipulate LatLon objects using GeoVectors:\n\n```python\n>> vector = (honolulu - palmyra) * 2 # A GeoVector with 2x the magnitude of a vector from palmyra to honolulu\n>> print(vector) # Print heading and magnitude\n14.6907922022 3533.38260751\nprint(palmyra + (vector/2.0)) # Recreate the coordinates of Honolulu by adding half of vector to palmyra\n21.3, -157.8167\n```\n\n#### Version\n1.0.2 - Tested on Python 2.7 with Eclipse IDLE. Please let me know of any issues.\n\n#### Changelog\n\n##### 1.0.3 (June/16/2019)\n> * Support for Python 2.7 and Python 3\n\n##### 1.0.2 (OCTOBER/14/2014)\n\n> * Class GeoVector is now an abstract class to ensure that any subclasses use the correct API\n> * Added methods range180 and range360 to class Longitude to interconvert between longitudes reported -180 to 180 format and those reported in 0 to 360 format. To ensure that all operations such as hemisphere assignment work as expected, longitudes reported in 0 to 360 format are automatically converted into -180 to 180 format when the Longitude object is initialized.\n\n##### 1.0.1 (SEPTEMBER/2/2014)\n\n> * Fixed issue with where attribute theta in GeoVector was treated in some cases like a heading (i.e. starting with due north and continuing clockwise) even though it was in fact an angle (i.e. starting with (1, 0) and continuing anti-clockwise). The attribute name has now been changed to heading to eliminate confusion. The local variable theta is used for computations involving angle.\n> * Added testing functions with pytest for class LatLon and GeoVector\n> * Added almost_equal methods to class LatLon and GeoVector to deal with float errors in decimal degree specification\n> * LatLon.project now returns (x, y) instead of (y, x) to be more consistent with the accepted convention.\n\n##### 0.91 (AUGUST/28/2014)\n\n> * degree, minute and second attributes for GeoCoord class are now coerced to type float\n\n##### 0.90 (AUGUST/28/2014)\n\n> * Updated magic methods for GeoCoord class\n> * Added option for instantiating LatLon from scalars\n\n##### 0.80 (AUGUST/27/2014)\n\n> * Added GeoVector class to handle vectors between two LatLon objects\n> * Cleaned up __str__ and __repr__ methods for LatLon, Latitude, Longitude, GeoCoord, and GeoVector classes\n\n##### 0.70 (AUGUST/27/2014)\n\n> * Deprecated LatLon.distance_sphere method. From now on use distance(other, ellipse = \u2018sphere\u2019) instead\n> * Added LatLon.bearing method to return the initial bearing between two LatLon objects\n> * Added LatLon.offset method to return a new LatLon object that is computed from an initial LatLon object plus a bearing and distance\n\n##### 0.60 (AUGUST/27/2014)\n\n> * Added compatibility with comparison, negation, addition and multiplication magic methods\n\n##### 0.50 (AUGUST/20/2014)\n\n> * First release", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/search5/latlon", "keywords": "", "license": "GNU General Public License v3 (GPLv3)", "maintainer": "", "maintainer_email": "", "name": "latlon3", "package_url": "https://pypi.org/project/latlon3/", "platform": "", "project_url": "https://pypi.org/project/latlon3/", "project_urls": { "Homepage": "https://github.com/search5/latlon" }, "release_url": "https://pypi.org/project/latlon3/1.0.3/", "requires_dist": null, "requires_python": "", "summary": "Methods for representing geographic coordinates", "version": "1.0.3" }, "last_serial": 5406257, "releases": { "1.0.3": [ { "comment_text": "", "digests": { "md5": "6bd1c70b60d44fa41c66fc408b713290", "sha256": "5d30c20e134be68ba5c681b02236f65f27debee7e02900d04f6ee2ca6f9ad3de" }, "downloads": -1, "filename": "latlon3-1.0.3.tar.gz", "has_sig": false, "md5_digest": "6bd1c70b60d44fa41c66fc408b713290", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10483, "upload_time": "2019-06-16T11:55:35", "url": "https://files.pythonhosted.org/packages/e6/87/b0a0dca60d6b08399dff9206c5549b12f44dff0f378ef59b73712e06728c/latlon3-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6bd1c70b60d44fa41c66fc408b713290", "sha256": "5d30c20e134be68ba5c681b02236f65f27debee7e02900d04f6ee2ca6f9ad3de" }, "downloads": -1, "filename": "latlon3-1.0.3.tar.gz", "has_sig": false, "md5_digest": "6bd1c70b60d44fa41c66fc408b713290", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10483, "upload_time": "2019-06-16T11:55:35", "url": "https://files.pythonhosted.org/packages/e6/87/b0a0dca60d6b08399dff9206c5549b12f44dff0f378ef59b73712e06728c/latlon3-1.0.3.tar.gz" } ] }