Skip to main content
Help us improve Python packaging – donate today!

Python implementation of the S2 Geometry Library

Project Description

s2sphere

https://travis-ci.org/sidewalklabs/sphere.svg?branch=modularize

Python implementation of a part of the C++ S2 Geometry Library. The S2 Geometry Library is explained in more detail here.

It maps a sphere to a 1D index. This enables scalable proximity searches on distributed indices such as with MongoDB and App Engine Datastore. The test cases of this package are quite extensive and reflect those in the original S2 Geometry Library.

Documentation: http://s2sphere.readthedocs.org

Getting Started

pip install s2sphere  # not yet
pip install https://github.com/sidewalklabs/sphere/archive/modularize.zip

For example, to get the S2 cells covering a LatLon-rectangle:

import s2sphere

r = s2sphere.RegionCoverer()
p1 = s2sphere.LatLon.from_degrees(33, -122)
p2 = s2sphere.LatLon.from_degrees(33.1, -122.1)
cell_ids = r.get_covering(s2sphere.LatLonRect.from_point_pair(p1, p2))
print(cell_ids)

which prints this list:

[9291041754864156672, 9291043953887412224, 9291044503643226112, 9291045878032760832, 9291047252422295552, 9291047802178109440, 9291051650468806656, 9291052200224620544]

Release history Release notifications

History Node

0.2.5

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.4

This version
History Node

0.1.3

History Node

0.1.2

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
s2sphere-0.1.3-py2.py3-none-any.whl (21.8 kB) Copy SHA256 hash SHA256 Wheel 2.7 Apr 27, 2016
s2sphere-0.1.3.tar.gz (20.7 kB) Copy SHA256 hash SHA256 Source None Apr 27, 2016

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