Outside Oklahoma? Jump to Fab Lab Tulsa or drag the pin on the map!

Oklahoma Boundaries

Waiting for browser ...

Introduction

The Boundary Service API provides a RESTful interface to a wealth of data about official geographic boundaries within Oklahoma. Data is retrieved from the API as JSON (optionally JSONP) with nested GeoJSON for describing the boundary shapes.

There are two resources described by the API: Boundary Sets and Boundaries.

Boundary Sets

Boundary Sets describe the extent and provenance of a group of Boundaries as well how recently they were last updated. Here, for example, is the Boundary Set for municipal boundaries:

{
    "authority": "CSA",
    "boundaries": [
        "/boundary/1.0/boundary/achille-municipal-boundary/",
        "/boundary/1.0/boundary/adair-municipal-boundary/",
        ...
        ...
        ...
        "/boundary/1.0/boundary/yeager-municipal-boundary/",
        "/boundary/1.0/boundary/yukon-municipal-boundary/",
        "/boundary/1.0/boundary/yukon-municipal-boundary-2/"
    ],
    "count": 1485,
    "domain": "Oklahoma",
    "href": "",
    "last_updated": "2012-03-15",
    "metadata_fields": [
        "ST_FIPS",
        "CO_FIPS",
        "CITYNAME",
        "FIPS",
        "FIPSCC",
        "AD_VAL_NUM",
        "LAST_ANNEX",
        "LAST_VERIF",
        "REMARKS"
    ],
    "name": "Municipal Boundaries",
    "notes": "",
    "resource_uri": "/boundary/1.0/boundary-set/municipal-boundaries/",
    "slug": "municipal-boundaries"

}

To see a paginated list of available Boundary Sets access the following URL:

http://www.oklahomadata.org/boundary/1.0/boundary-set/

Descriptions of all the properties of a Boundary Set can be accessed at:

http://www.oklahomadata.org/boundary/1.0/boundary-set/schema/

A single Boundary Set may be accessed directly by its slug:

http://www.oklahomadata.org/boundary/1.0/boundary-set/municipal-boundaries/

Boundaries

Boundaries are the individual shapes within a Boundary Set. The Boundary for Tulsa County looks like:

{
    "centroid": {
        "coordinates": [
            -95.941506,
            36.121079
        ],
        "type": "Point"
    },
    "external_id": "143",
    "kind": "County",
    "metadata": {
        "COUNTY": 143,
        "NAME": "TULSA",
        "STATE": 40,
        "STATEPLANE": "N"
    },
    "name": "TULSA",
    "resource_uri": "/boundary/1.0/boundary/tulsa-county/",
    "set": "/boundary/1.0/boundary-set/counties/",
    "simple_shape": {
        "coordinates": [
            [
                [
                    [
                        -95.761625,
                        35.973807
                    ],
                    [
                        -95.761563,
                        35.9065
                    ],
                    ...
                    ...
                    ...,
                    [
                        -95.761683,
                        36.162672
                    ],
                    [
                        -95.761763,
                        36.085538
                    ],
                    [
                        -95.761625,
                        35.973807
                    ]
                ]
            ]
        ],
        "type": "MultiPolygon"
    },
    "slug": "tulsa-county"

}

A paginated list of all Boundaries can be accessed at:

http://www.oklahomadata.org/boundary/1.0/boundary/

As with Boundary Sets a description of all properties returned with the Boundary can be retrieved from:

http://www.oklahomadata.org/boundary/1.0/boundary/schema/

And a single Boundary may be accessed directly by its slug:

http://www.oklahomadata.org/boundary/1.0/boundary/tulsa-county/

For ease of URL construction a Boundary may also be referenced by appending the Boundary's external_id property to it's parent Boundary Set's URL. For example:

http://www.oklahomadata.org/boundary/1.0/boundary-set/municipal-boundaries/2

Note: The metadata fields returned with a Boundary are taken directly from the original data sources. In certain cases these may be out of date. An effort has been made to capture such issues in the Boundary Set's notes property, but these values should generally not be taken at face value.

Limiting resources returned

Pagination of returned resources is handled with the limit and offset parameters:

http://www.oklahomadata.org/boundary/1.0/boundary/?limit=10&offset=10

In addition, queries may (and should) be constrained by passing a comma-delimited list of Boundary Set slugs to the sets parameter:

http://www.oklahomadata.org/boundary/1.0/boundary/?sets=municipal-boundaries,counties

Point queries

The fundamental query exposed by the Boundary Service is a point-in-polygon search by latitude and longitude. Here is an example:

http://www.oklahomadata.org/boundary/1.0/boundary/?contains=36.15061,-95.958351&sets=municipal-boundaries

This will return the municipal boundary that Fab Lab Tulsa resides in.

Note: In addition to the contains parameter we also pass the sets parameter to constrain the query. Its important to use this parameter to limit your queries to only the data you need so your queries will be fast.

Near queries

The near query finds all Boundaries that intersect a circle of a specified radius using a given point as its center:

http://www.oklahomadata.org/boundary/1.0/boundary/?near=36.15061,-95.958351,1mi&sets=municipal-boundaries

This returns all municipal boundaries within one mile of Fab Lab Tulsa. The radius parameter may be specified in any units supported by GeoDjango.

Note: This query will execute more slowly than the point query.

Intersection queries

The intersects query finds all Boundaries which intersect a specified Boundary. For example, to find all municipal boundaries which intersect the Tulsa County, one would request:

http://www.oklahomadata.org/boundary/1.0/boundary/?intersects=tulsa-county&sets=municipal-boundaries

The Boundary Service does not currently support querying by arbitrary shapes.

JSONP

For use in client-side applications the Boundary Service API may be accessed via JSONP. Simply append the format and callback parameters to the query string:

http://www.oklahomadata.org/boundary/1.0/boundary/?format=jsonp&callback=func

Build your own boundary service!

The source code for this Boundary Service instance is hosted on GitHub. You are welcome to copy, modify and reuse it as you see fit. We are also very happy to accept bug reports and patches!

https://github.com/tulsawebdevs/django-boundaryservice

License

All source and assets are licensed under the permissive MIT license.

About

The Boundary Service software is a product of the News Applications team at the Chicago Tribune.

This API is provided as a free service for the community.

Open Data

The data for this project was acquired from a variety of agencies. Documentation of exactly how and where the data was retrieved is available by accessing any Boundary Set via the API. Examples can be found on the API page.