Skip to main content
https://travis-ci.org/MacHu-GWU/cazipcode-project.svg?branch=master https://img.shields.io/pypi/v/cazipcode.svg https://img.shields.io/pypi/l/cazipcode.svg https://img.shields.io/pypi/pyversions/cazipcode.svg

Welcome to cazipcode Documentation

Powerful Canada zipcode search engine. Powerful geo lat lng search, fuzzy province, city name search out of the box. And powerful search API with high performance sorting.

Features

  • 200,000 + postal code covers most of the place.

  • Rich information of postalcode is available:

{
    "postalcode": "K1G 0A1",
    "province": "ON",
    "city": "Ottawa",
    "area_name": "Ottawa",
    "area_code": 613,
    "latitude": 45.417874,
    "longitude": -75.648284,
    "population": 33994,
    "dwellings": 14817,
    "elevation": 56,
    "timezone": 5,
    "day_light_savings": 1
}
  • Human friendly API

from cazipcode import fields, SearchEngine

with SearchEngine() as search:
    # built-in geo search
    result = search.near(lat=45.477873, lng=-75.721100, radius=100)

    # by province, fuzzy name search.
    result = search.by_province("on")

    # by city, fuzzy name search.
    result = search.by_city("otawa")

    # easy to sort and limit result
    # Top 5 high population postal ocde in ON
    result = search.by_province("on",
        sort_by=fields.province, ascending=False, returns=10)

    # by population dwellings timezone
    result = search.by_population(population_greater=10000)
    result = search.by_dwellings(dwellings_greater=10000)
    result = search.by_timezone(timezone_greater=5, timezone_less=8)

    # by 3-d space
    (
        lat_greater, lat_less, lng_greater, lng_less,
        elevation_greater, elevation_less,
    ) = None, None, None, None, None, None
    result = search.by_lat_lng_elevation(
        lat_greater, lat_less, lng_greater, lng_less,
        elevation_greater, elevation_less,
    )
  • Powerful query

from cazipcode import fields, SearchEngine

# combination of any criterions
result = search.find(
    lat=None, lng=None, radius=None,
    lat_greater=None, lat_less=None,
    lng_greater=None, lng_less=None,
    elevation_greater=None, elevation_less=None,
    prefix=None,
    substring=None,
    province=None, city=None, area_name=None,
    area_code=None,
    population_greater=None, population_less=None,
    dwellings_greater=None, dwellings_less=None,
    timezone=None, timezone_greater=None, timezone_less=None,
    day_light_savings=None,
    sort_by=None,
    ascending=True,
    returns=5,
)

Install

cazipcode is released on PyPI, so all you need is:

$ pip install cazipcode

To upgrade to latest version:

$ pip install --upgrade cazipcode

Release files for cazipcode 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cazipcode 0.0.2
File Size Uploaded
cazipcode-0.0.2.tar.gz 2.9 MB Details

Release files / cazipcode-0.0.2.tar.gz

Download URL cazipcode-0.0.2.tar.gz
Size 2.9 MB
Tags Source
SHA-256 checksum
How to use checksums
6ae73ad3cb0121b3e0f14d01ec3d6ed5bf2cd576e1c88ac5ec7e0ce246a6352b
BLAKE2b-256 checksum
How to use checksums
83c51c1c145a39bdd541fb17bc1d0333ac2eaf66b571b9ed9148c3844b31877c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page