mercantile


Namemercantile JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://github.com/mapbox/mercantile
SummaryWeb mercator XYZ tile utilities
upload_time2021-04-21 14:42:41
maintainer
docs_urlNone
authorSean Gillies
requires_python
licenseBSD
keywords mapping web mercator tiles
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ==========
Mercantile
==========

.. image:: https://travis-ci.com/mapbox/mercantile.svg
   :target: https://travis-ci.com/mapbox/mercantile
   :alt: Build Status

.. image:: https://coveralls.io/repos/github/mapbox/mercantile/badge.svg?branch=master
   :target: https://coveralls.io/github/mapbox/mercantile?branch=master
   :alt: Coverage Status

.. image:: https://readthedocs.org/projects/mercantile/badge/?version=latest
   :target: http://mercantile.readthedocs.io/en/latest/?badge=latest
   :alt: Documentation Status

Spherical mercator coordinate and tile utilities

Documentation: http://mercantile.readthedocs.io/en/latest/

The mercantile module provides ``ul(xtile, ytile, zoom)`` and ``bounds(xtile,
ytile, zoom)`` functions that respectively return the upper left corner and
bounding longitudes and latitudes for XYZ tiles, a ``xy(lng, lat)`` function
that returns spherical mercator x and y coordinates, a ``tile(lng, lat,
zoom)`` function that returns the tile containing a given point, and
quadkey conversion functions ``quadkey(xtile, ytile, zoom)`` and
``quadkey_to_tile(quadkey)`` for translating between quadkey and tile
coordinates.

.. code-block:: pycon

    >>> import mercantile
    >>> mercantile.ul(486, 332, 10)
    LngLat(lng=-9.140625, lat=53.33087298301705)
    >>> mercantile.bounds(486, 332, 10)
    LngLatBbox(west=-9.140625, south=53.12040528310657, east=-8.7890625, north=53.33087298301705)
    >>> mercantile.xy(*mercantile.ul(486, 332, 10))
    (-1017529.7205322663, 7044436.526761846)
    >> mercantile.xy_bounds(486, 332, 10)
    Bbox(left=-1017529.7205322663, bottom=7005300.768279833, right=-978393.962050256, top=7044436.526761846)
    >>> mercantile.tile(*mercantile.ul(486, 332, 10) + (10,))
    Tile(x=486, y=332, z=10)
    >>> mercantile.quadkey(486, 332, 10)
    '0313102310'
    >>> mercantile.quadkey_to_tile('0313102310')
    Tile(x=486, y=332, z=10)

Also in mercantile are functions to traverse the tile stack.

.. code-block:: pycon

    >>> mercantile.parent(486, 332, 10)
    Tile(x=243, y=166, z=9)
    >>> mercantile.children(mercantile.parent(486, 332, 10))
    [Tile(x=486, y=332, z=10), Tile(x=487, y=332, z=10), Tile(x=487, y=333, z=10), Tile(x=486, y=333, z=10)]

Named tuples are used to represent tiles, coordinates, and bounding boxes.

Mercantile CLI
==============

Mercantile's command line interface, named "mercantile", has commands for 
getting the shapes of Web Mercator tiles as GeoJSON and getting the tiles
that intersect with a GeoJSON bounding box. 

.. code-block:: console

	$ mercantile --help
	Usage: mercantile [OPTIONS] COMMAND [ARGS]...

	  Command line interface for the Mercantile Python package.

	Options:
	  -v, --verbose  Increase verbosity.
	  -q, --quiet    Decrease verbosity.
	  --version      Show the version and exit.
	  --help         Show this message and exit.

	Commands:
	  bounding-tile  Print the bounding tile of a lng/lat point, bounding box, or
					 GeoJSON objects.
	  children       Print the children of the tile.
	  neighbors      Print the neighbors of the tile.
	  parent         Print the parent tile.
	  quadkey        Convert to/from quadkeys.
	  shapes         Print the shapes of tiles as GeoJSON.
	  tiles          Print tiles that overlap or contain a lng/lat point, bounding
					 box, or GeoJSON objects.

See Also
========

`supermercado <https://github.com/mapbox/supermercado>`__ is another python lib
with added tile logic functionality (union tile shapes, find edge tiles, and
find tile intersections for complex geometries).

`node-sphericalmercator <https://github.com/mapbox/node-sphericalmercator>`__
provides many of the same features for Node.

`tilebelt <https://github.com/mapbox/tilebelt>`__ has some of the GeoJSON
features as mercantile and a few more (tile parents, quadkey).

`morecantile <https://github.com/developmentseed/morecantile>`__ is like mercantile,
but with support for other TileMatrixSet grids.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mapbox/mercantile",
    "name": "mercantile",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "mapping,web mercator,tiles",
    "author": "Sean Gillies",
    "author_email": "sean@mapbox.com",
    "download_url": "https://files.pythonhosted.org/packages/d2/c6/87409bcb26fb68c393fa8cf58ba09363aa7298cfb438a0109b5cb14bc98b/mercantile-1.2.1.tar.gz",
    "platform": "",
    "description": "==========\nMercantile\n==========\n\n.. image:: https://travis-ci.com/mapbox/mercantile.svg\n   :target: https://travis-ci.com/mapbox/mercantile\n   :alt: Build Status\n\n.. image:: https://coveralls.io/repos/github/mapbox/mercantile/badge.svg?branch=master\n   :target: https://coveralls.io/github/mapbox/mercantile?branch=master\n   :alt: Coverage Status\n\n.. image:: https://readthedocs.org/projects/mercantile/badge/?version=latest\n   :target: http://mercantile.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation Status\n\nSpherical mercator coordinate and tile utilities\n\nDocumentation: http://mercantile.readthedocs.io/en/latest/\n\nThe mercantile module provides ``ul(xtile, ytile, zoom)`` and ``bounds(xtile,\nytile, zoom)`` functions that respectively return the upper left corner and\nbounding longitudes and latitudes for XYZ tiles, a ``xy(lng, lat)`` function\nthat returns spherical mercator x and y coordinates, a ``tile(lng, lat,\nzoom)`` function that returns the tile containing a given point, and\nquadkey conversion functions ``quadkey(xtile, ytile, zoom)`` and\n``quadkey_to_tile(quadkey)`` for translating between quadkey and tile\ncoordinates.\n\n.. code-block:: pycon\n\n    >>> import mercantile\n    >>> mercantile.ul(486, 332, 10)\n    LngLat(lng=-9.140625, lat=53.33087298301705)\n    >>> mercantile.bounds(486, 332, 10)\n    LngLatBbox(west=-9.140625, south=53.12040528310657, east=-8.7890625, north=53.33087298301705)\n    >>> mercantile.xy(*mercantile.ul(486, 332, 10))\n    (-1017529.7205322663, 7044436.526761846)\n    >> mercantile.xy_bounds(486, 332, 10)\n    Bbox(left=-1017529.7205322663, bottom=7005300.768279833, right=-978393.962050256, top=7044436.526761846)\n    >>> mercantile.tile(*mercantile.ul(486, 332, 10) + (10,))\n    Tile(x=486, y=332, z=10)\n    >>> mercantile.quadkey(486, 332, 10)\n    '0313102310'\n    >>> mercantile.quadkey_to_tile('0313102310')\n    Tile(x=486, y=332, z=10)\n\nAlso in mercantile are functions to traverse the tile stack.\n\n.. code-block:: pycon\n\n    >>> mercantile.parent(486, 332, 10)\n    Tile(x=243, y=166, z=9)\n    >>> mercantile.children(mercantile.parent(486, 332, 10))\n    [Tile(x=486, y=332, z=10), Tile(x=487, y=332, z=10), Tile(x=487, y=333, z=10), Tile(x=486, y=333, z=10)]\n\nNamed tuples are used to represent tiles, coordinates, and bounding boxes.\n\nMercantile CLI\n==============\n\nMercantile's command line interface, named \"mercantile\", has commands for \ngetting the shapes of Web Mercator tiles as GeoJSON and getting the tiles\nthat intersect with a GeoJSON bounding box. \n\n.. code-block:: console\n\n\t$ mercantile --help\n\tUsage: mercantile [OPTIONS] COMMAND [ARGS]...\n\n\t  Command line interface for the Mercantile Python package.\n\n\tOptions:\n\t  -v, --verbose  Increase verbosity.\n\t  -q, --quiet    Decrease verbosity.\n\t  --version      Show the version and exit.\n\t  --help         Show this message and exit.\n\n\tCommands:\n\t  bounding-tile  Print the bounding tile of a lng/lat point, bounding box, or\n\t\t\t\t\t GeoJSON objects.\n\t  children       Print the children of the tile.\n\t  neighbors      Print the neighbors of the tile.\n\t  parent         Print the parent tile.\n\t  quadkey        Convert to/from quadkeys.\n\t  shapes         Print the shapes of tiles as GeoJSON.\n\t  tiles          Print tiles that overlap or contain a lng/lat point, bounding\n\t\t\t\t\t box, or GeoJSON objects.\n\nSee Also\n========\n\n`supermercado <https://github.com/mapbox/supermercado>`__ is another python lib\nwith added tile logic functionality (union tile shapes, find edge tiles, and\nfind tile intersections for complex geometries).\n\n`node-sphericalmercator <https://github.com/mapbox/node-sphericalmercator>`__\nprovides many of the same features for Node.\n\n`tilebelt <https://github.com/mapbox/tilebelt>`__ has some of the GeoJSON\nfeatures as mercantile and a few more (tile parents, quadkey).\n\n`morecantile <https://github.com/developmentseed/morecantile>`__ is like mercantile,\nbut with support for other TileMatrixSet grids.\n\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Web mercator XYZ tile utilities",
    "version": "1.2.1",
    "split_keywords": [
        "mapping",
        "web mercator",
        "tiles"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "81eaf8ce70d136de0db9e774c8463abf",
                "sha256": "30f457a73ee88261aab787b7069d85961a5703bb09dc57a170190bc042cd023f"
            },
            "downloads": -1,
            "filename": "mercantile-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "81eaf8ce70d136de0db9e774c8463abf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 14779,
            "upload_time": "2021-04-21T14:42:39",
            "upload_time_iso_8601": "2021-04-21T14:42:39.841368Z",
            "url": "https://files.pythonhosted.org/packages/b2/d6/de0cc74f8d36976aeca0dd2e9cbf711882ff8e177495115fd82459afdc4d/mercantile-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "f6d344513652d10894a30f8e8a674b30",
                "sha256": "fa3c6db15daffd58454ac198b31887519a19caccee3f9d63d17ae7ff61b3b56b"
            },
            "downloads": -1,
            "filename": "mercantile-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f6d344513652d10894a30f8e8a674b30",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 26352,
            "upload_time": "2021-04-21T14:42:41",
            "upload_time_iso_8601": "2021-04-21T14:42:41.096530Z",
            "url": "https://files.pythonhosted.org/packages/d2/c6/87409bcb26fb68c393fa8cf58ba09363aa7298cfb438a0109b5cb14bc98b/mercantile-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-04-21 14:42:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "mapbox",
    "github_project": "mercantile",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "tox": true,
    "lcname": "mercantile"
}
        
Elapsed time: 0.02539s