geog


Namegeog JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/jwass/geog
SummaryNumpy-based vectorized geospatial functions
upload_time2016-02-04 14:59:37
maintainerNone
docs_urlNone
authorJacob Wasserman
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            geog
====

A pure numpy implementation for geodesic functions. The interfaces are
vectorized according to numpy broadcasting rules compatible with a variety of
inputs including lists, numpy arrays, and
[Shapely](http://toblerity.org/shapely/) geometries - allowing for 1-to-1,
N-to-1, or the element-wise N-to-N calculations in a single call.

`geog` uses a spherical Earth model (subject to change) with radius 6371.0 km.

`geog` draws inspiration from [TurfJS](https://www.turfjs.org)


Operations
---------
* `distance` - Compute the distance in meters between any number of longitude,latitude points
* `course` - Compute the forward azimuth between points
* `propagate` - Starting from some points and pointing azimuths, move some
distance and compute the final points.


Getting Started
---------------

Compute the distance in meters between two locations on the surface of the
Earth.
```
>>> import geog

>>> boston = [-71.0589, 42.3601]
>>> la = [-118.2500, 34.0500]

>>> geog.distance(boston, la)
4179393.4717019284


>>> geog.course(boston, la)
176.76437002826202

```

`geog` allows different sizes of inputs conforming to numpy broadcasting
rules

Compute the distances from several points to one point.
```
>>> dc = [-77.0164, 38.9047]
>>> paris = [2.3508, 48.8567]
>>> geog.distance([boston, la, dc], paris)
array([ 5531131.56144631,  9085960.07227854,  6163490.48394848])

```

Compute the element-wise distance of several points to several points
```
>>> sydney = [151.2094, -33.865]
>>> barcelona = [2.1833, 41.3833]
>>> geog.distance([boston, la, dc], [paris, sydney, barcelona])
array([  5531131.56144631,  12072666.9425518 ,   6489222.58111716])

```

`geog` functions can take numpy arrays as inputs
```
>>> import numpy as np
>>> points = np.array([boston, la, dc])
>>> points
array([[ -71.0589,   42.3601],
       [-118.25  ,   34.05  ],
       [ -77.0164,   38.9047]])
>>> geog.distance(points, sydney)
array([ 16239763.03982447,  12072666.9425518 ,  15711932.63508411])
```


`geog` functions can also take Shapely geometries as inputs
```
>>> import shapely.geometry
>>> p = shapely.geometry.Point([-90.0667, 29.9500])
>>> geog.distance(points, p)
array([ 2185738.94680724,  2687705.07260978,  1554066.84579387])

```


Other Uses
----------------
Use `propagate` to buffer a single point by passing in multiple angles.

```
>>> n_points = 6
>>> d = 100  # meters
>>> angles = np.linspace(0, 360, n_points)
>>> polygon = geog.propagate(p, angles, d)

```

Compute the length of a line over the surface.
```
>>> np.sum(geog.distance(line[:-1,:], line[1:,:]))
```


Quick Documentation
-------------
`distance(p0, p1, deg=True)`

`course(p0, p1, deg=True, bearing=False)`

`propagate(p0, angle, d, deg=True, bearing=False)`

For all of the above, `p0` or `p1` can be:
- single list, tuple, or Shapely Point of [lon, lat] coordinates
- list of [lon, lat] coordinates or Shapely Points
- N x 2 numpy array of (lon, lat) coordinates

If argument `deg` is False, then all angle arguments, coordinates and
azimuths, will be used as radians. If `deg` is False in `course()`, then it's
output will also be radians.

Consult the documentation on each function for more detailed descriptions of
the arguments.


Conventions
-----------
* All points, or point-like objects assume a longitude, latitude ordering.
* Arrays of points have shape `N x 2`.
* Azimuth/course is measured with 0 degrees as due East, increasing
  counter-clockwise so that 90 degrees is due North. The functions that
operate on azimuth accept a `bearing=True` argument to use the more
traditional definition where 0 degrees is due North increasing clockwise such
that that 90 degrees is due East.


Installation
-----------
geog is hosted on PyPI.

```
pip install geog
```


See also
--------
* `geog` is partly inspired by [TurfJS](https://www.turfjs.org)

* [PostGIS](http://postgis.net/docs/manual-1.5/ch04.html#Geography_Basics) geography type
* [Shapely](https://github.com/toblerity/shapely)
* [Proj.4](https://trac.osgeo.org/proj/)
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jwass/geog",
    "name": "geog",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Jacob Wasserman",
    "author_email": "jwasserman@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cd/04/5cee7294d377214811b7d4d56fbc3da38e9d68e7ec50e53c6fb583a93965/geog-0.0.2.tar.gz",
    "platform": "UNKNOWN",
    "description": "geog\n====\n\nA pure numpy implementation for geodesic functions. The interfaces are\nvectorized according to numpy broadcasting rules compatible with a variety of\ninputs including lists, numpy arrays, and\n[Shapely](http://toblerity.org/shapely/) geometries - allowing for 1-to-1,\nN-to-1, or the element-wise N-to-N calculations in a single call.\n\n`geog` uses a spherical Earth model (subject to change) with radius 6371.0 km.\n\n`geog` draws inspiration from [TurfJS](https://www.turfjs.org)\n\n\nOperations\n---------\n* `distance` - Compute the distance in meters between any number of longitude,latitude points\n* `course` - Compute the forward azimuth between points\n* `propagate` - Starting from some points and pointing azimuths, move some\ndistance and compute the final points.\n\n\nGetting Started\n---------------\n\nCompute the distance in meters between two locations on the surface of the\nEarth.\n```\n>>> import geog\n\n>>> boston = [-71.0589, 42.3601]\n>>> la = [-118.2500, 34.0500]\n\n>>> geog.distance(boston, la)\n4179393.4717019284\n\n\n>>> geog.course(boston, la)\n176.76437002826202\n\n```\n\n`geog` allows different sizes of inputs conforming to numpy broadcasting\nrules\n\nCompute the distances from several points to one point.\n```\n>>> dc = [-77.0164, 38.9047]\n>>> paris = [2.3508, 48.8567]\n>>> geog.distance([boston, la, dc], paris)\narray([ 5531131.56144631,  9085960.07227854,  6163490.48394848])\n\n```\n\nCompute the element-wise distance of several points to several points\n```\n>>> sydney = [151.2094, -33.865]\n>>> barcelona = [2.1833, 41.3833]\n>>> geog.distance([boston, la, dc], [paris, sydney, barcelona])\narray([  5531131.56144631,  12072666.9425518 ,   6489222.58111716])\n\n```\n\n`geog` functions can take numpy arrays as inputs\n```\n>>> import numpy as np\n>>> points = np.array([boston, la, dc])\n>>> points\narray([[ -71.0589,   42.3601],\n       [-118.25  ,   34.05  ],\n       [ -77.0164,   38.9047]])\n>>> geog.distance(points, sydney)\narray([ 16239763.03982447,  12072666.9425518 ,  15711932.63508411])\n```\n\n\n`geog` functions can also take Shapely geometries as inputs\n```\n>>> import shapely.geometry\n>>> p = shapely.geometry.Point([-90.0667, 29.9500])\n>>> geog.distance(points, p)\narray([ 2185738.94680724,  2687705.07260978,  1554066.84579387])\n\n```\n\n\nOther Uses\n----------------\nUse `propagate` to buffer a single point by passing in multiple angles.\n\n```\n>>> n_points = 6\n>>> d = 100  # meters\n>>> angles = np.linspace(0, 360, n_points)\n>>> polygon = geog.propagate(p, angles, d)\n\n```\n\nCompute the length of a line over the surface.\n```\n>>> np.sum(geog.distance(line[:-1,:], line[1:,:]))\n```\n\n\nQuick Documentation\n-------------\n`distance(p0, p1, deg=True)`\n\n`course(p0, p1, deg=True, bearing=False)`\n\n`propagate(p0, angle, d, deg=True, bearing=False)`\n\nFor all of the above, `p0` or `p1` can be:\n- single list, tuple, or Shapely Point of [lon, lat] coordinates\n- list of [lon, lat] coordinates or Shapely Points\n- N x 2 numpy array of (lon, lat) coordinates\n\nIf argument `deg` is False, then all angle arguments, coordinates and\nazimuths, will be used as radians. If `deg` is False in `course()`, then it's\noutput will also be radians.\n\nConsult the documentation on each function for more detailed descriptions of\nthe arguments.\n\n\nConventions\n-----------\n* All points, or point-like objects assume a longitude, latitude ordering.\n* Arrays of points have shape `N x 2`.\n* Azimuth/course is measured with 0 degrees as due East, increasing\n  counter-clockwise so that 90 degrees is due North. The functions that\noperate on azimuth accept a `bearing=True` argument to use the more\ntraditional definition where 0 degrees is due North increasing clockwise such\nthat that 90 degrees is due East.\n\n\nInstallation\n-----------\ngeog is hosted on PyPI.\n\n```\npip install geog\n```\n\n\nSee also\n--------\n* `geog` is partly inspired by [TurfJS](https://www.turfjs.org)\n\n* [PostGIS](http://postgis.net/docs/manual-1.5/ch04.html#Geography_Basics) geography type\n* [Shapely](https://github.com/toblerity/shapely)\n* [Proj.4](https://trac.osgeo.org/proj/)",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Numpy-based vectorized geospatial functions",
    "version": "0.0.2",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "28137dcf19f8f804a92e51e5736dd4ce",
                "sha256": "9b6b020b72bf135d49299115e5a4a751f2432def4d4cd87d10b48a5ae51ec643"
            },
            "downloads": -1,
            "filename": "geog-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "28137dcf19f8f804a92e51e5736dd4ce",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4966,
            "upload_time": "2016-02-04T14:59:37",
            "upload_time_iso_8601": "2016-02-04T14:59:37.622505Z",
            "url": "https://files.pythonhosted.org/packages/cd/04/5cee7294d377214811b7d4d56fbc3da38e9d68e7ec50e53c6fb583a93965/geog-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2016-02-04 14:59:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "jwass",
    "github_project": "geog",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "geog"
}
        
Elapsed time: 0.04456s