{% extends 'base.html' %} {% block content %}

API v1

The docs below will help you use the API once you have repos and feature sets synced. To learn more about syncing repos and feature sets, see how it works.

The Resource

http://gitspatial.com/:user_name/:repo_name/:feature_set_name
user_name Your GitHub user name
repo_name A GitHub repo name
feature_set_name A file in your repo that contains GeoJSON

From here, with no URL parameters, you'll just get a paginated list of features.

Search by Bounding Box

http://gitspatial.com/:user_name/:repo_name/:feature_set_name?bbox=:xmin,:ymin,:ymax,:ymax

Parameters

bbox The geographic bounding box to search for features in xmin, ymin, mxax, ymax (min longitude, min latitude, max longitude, max latitude) format

Example

Find parks in a map window.

http://gitspatial.com/api/v1/JasonSanford/mecklenburg-gis-opendata/parks?bbox=-80.8633,35.2071,-80.8158,35.2488

Search by Point and Radius

http://gitspatial.com/:user_name/:repo_name/:feature_set_name?lat=:latitude&lon=:longitude&distance=:distance
lat The latitude, or Y coordinate, for the point to search from
lon The longitude, or X coordinate, for the point to search from
distance Thie distance, in meters, to search for features

Example

Find schools within 4,000 meters of a point.

http://gitspatial.com/api/v1/JasonSanford/mecklenburg-gis-opendata/data/schools.geojson?lat=35.256&lon=-80.809&distance=4000

Other Parameters

limit The number of features to return. The default and maximum is 1000. Use with offset for pagination.
offset The number of features to skip

Response

The response body is a GeoJSON FeatureCollection. In addition to the required type and features members, there are the count and total_count members which represent the number of features in the current response and the total number of features respectively.

{
    "type": "FeatureCollection",
    "features": [
        {
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -80.838923,
                    35.220129
                ]
            },
            "type": "Feature",
            "properties": {
                "city": "CHARLOTTE",
                "address": "800 EAST 3RD ST",
                "type": "NEIGHBORHOOD PARK",
                "zipcode": "28202",
                "name": "MARSHALL NEIGHBORHOOD PARK"
            },
            "id": 31902
        },
        {
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -80.845156,
                    35.391193
                ]
            },
            "type": "Feature",
            "properties": {
                "city": "HUNTERSVILLE",
                "address": "",
                "type": "COMMUNITY PARK",
                "zipcode": "",
                "name": "HUNTERSVILLE ATHLETIC COMMUNITY PARK"
            },
            "id": 31901
        },
        ...
    ]
    "count": 1000,
    "total_count": 1254
}
{% endblock %}