Skip to main content

Library of bounding boxes of countries (and associated data)

Project description

Contains the bounding boxes and miscallaneous additional information for countries extracted from

Note that many countries have a number of “subunits”: geographically disjoint components like Alaska in the USA, administratively distinct regions such as the countries of Great Britain, or overseas islands for many European nations. As a result this module returns iterators over sets of Country objects for each country code, rather than single Country objects.

Previous versions of this library returned an (often large) singular bounding box for each country code; in many cases these spanned much of the globe and were therefore geographically less useful.


$ pip install country-bounding-boxes


>>> from country_bounding_boxes import (

Get a country by its 2- or 3-letter ISO code:

>>> [ for c in country_subunits_by_iso_code('ZW')]

>>> [ for c in country_subunits_by_iso_code('ZWE')]

>>> [ for c in country_subunits_by_iso_code('TM')]

>>> [ for c in country_subunits_by_iso_code('GB')]
['Wales', 'England', 'N. Ireland', 'Scotland']

Inspect bounding box as (lon1, lat1, lon2, lat2) tuples:

>>> [c.bbox for c in country_subunits_by_iso_code('TM')]
[(52.5024597512, 35.2706639674, 66.5461503437, 42.7515510117)]

>>> [c.bbox for c in country_subunits_by_iso_code('GB')]
[(-5.2623046875, 51.3904296875, -2.6623046875, 53.4192871094),
 (-5.65625, 50.0213867188, 1.74658203125, 55.8079589844),
 (-8.14482421875, 54.0512695312, -5.47041015625, 55.241796875),
 (-7.54296875, 54.689453125, -0.774267578125, 60.8318847656)]

Get a set of countries by their intersection with a point:

>>> [ for c in

>>> [ for c in
['Germany', 'France', 'Netherlands']


If you want to do development on the library, follow these steps:

  • Create a virtualenv
  • bin/pip install -r requirements/tests.txt
  • bin/nosetests -s country_bounding_boxes

Project details

Release history Release notifications

History Node


History Node


History Node


This version
History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
country-bounding-boxes-0.2.0.tar.gz (60.0 kB) Copy SHA256 hash SHA256 Source None May 29, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page