Skip to main content

Schools

Stable
US 🇺🇸 and Canada 🇨🇦

Description

Schools near locations in Canada and the United States can be accessed via Local Logic’s Schools endpoint, documented below. Schools will always be returned in order of least to greatest linear_distance away from the specified lat/lng.

In addition, schools data is available via flat file in Canada and in the United States for clients who prefer this delivery mechanism over the API endpoint.

Schools include basic details like addresses and contact information, and school characteristics which differ by country like grade levels, languages, and special programs. They also include catchment areas which are polygons around the school showing which residential locations are zoned for that specific school. For the purposes of the response, middle schools are returned as both primary and secondary/high schools.

Data Dictionary

The following is a table that contains payload fields and describes their meaning and possible values.

fielddescriptionvaluesformat
nameThe name of the school.String of 256 or less charactersString
addressThe street address of the school.String of 256 or less charactersString
cityThe city of the school.String of 256 or less charactersString
provinceThe province's postal code for the school.String of 2 charactersString
postalcodeThe postal code of the school.String of 7 characters.String
countryThe country name of the school.CanadaString
latThe latitude of the school.A numeric value in the range of [-90,90]Float
lngThe longitude of the school.A numeric value in the range of [-180,180]Float
urlThe website of the school.String of 256 or less charactersString
school_attributes.levelsThe levels of education offered by the school. It will depend on each individual school board, but generally, each level roughly corresponds with the following grade ranges:
  • preschool: kindergarten
  • elementary: grades 1 to 6
  • middle: grades 7 to 8
  • secondary: grades 9 to 12
  • preschool
  • elementary
  • middle
  • secondary
  • A list of strings from the values column. Ex: ['elementary', ‘secondary’]
    school_attributes.gradesThe grades offered by the school.Different range combinations:
  • 1 through 13
  • PK: pre-kindergarten
  • JK: junior kindergarten
  • SK: senior kindergarten
  • N: nursery
  • M: maternelle
  • A string containing a grade range from the values column, separated by a dash. Ex: JK-8
    school_attributes.languagesThe languages of instruction.Non-exhaustive list:
  • en: English
  • fr: French
  • cr: Cree
  • A list of strings from the values column. Ex: ['en', 'fr']
    school_attributes.programsThe programs offered by the school.Non-exhaustive list:
  • IB
  • French Immersion
  • Catholic
  • Arts

  • String of 256 or less characters
    A list of strings from the values column. Ex: ['IB', ‘Arts’]
    school_attributes.typesThe type of the school.
  • public
  • private
  • A list of strings from the values column. Ex: ['public']
    school_board_attributes.nameThe name of the school board.String of 256 or less charactersString
    school_board_attributes.urlThe website of the school board.String of 256 or less charactersString
    proximity.linear_distanceThe distance in meters between the school and the input lat/lng.Integer
    catchments.*.geometryA lat/lng multipolygon of the catchment area.List
    catchments.*.insideWhether or not the queried lat/lng fall inside the catchment.Bool
    catchments.*.programThe program offered to this catchment.String
    catchments.*.gradeThe grade offered to this catchment. Refer to school_attributes.grades for more information.String
    catchments.*.levelThe level offered to this catchment. Refer to school_attributes.levels for more information.String

    GET /v3/schools

    Up to 30 elementary schools and 30 high schools in a 25 000 meter (25 km or 15.53 miles) radius can be obtained through the API.

    Not all keys, including those under school_attributes and school_board_attributes, will always be present. Key availability depends on data availability, which varies by school and school board.

    GET /v3/schools

    This API uses JWT token based authentication. This JWT Bearer token is what is used to populate the Authorization header below.

    Instructions on how to retrieve this token can be found at Getting Started.

    HeaderStatusDescription
    AuthorizationrequiredYour bearer token retrieved from our authorization API, ex. Bearer eyJhbGci...
    AcceptrequiredThe datatype to request, this API will return application/json.

    QueryString

    The region to be queried by the endpoint can be defined two ways: (1) by specifying a lat/lng coordinate, with optional radius/radius_unit parameters, (2) or by providing a polygon parameter.

    When using the lat/lng coordinate query method without specifying radius/radius_unit parameters, the endpoint will return schools within a five minute walk of the coordinate. When including radius/radius_unit parameters, the resulting circular area around the lat/lng coordinate will be queried. radius_unit can be either meter or mile.

    When using the polygon query method, the schools returned will be within the region defined by the polygon area. Polygons are specified using the WKT format. The only accepted type is POLYGON, and holes are not supported. Each polygon point must be defined as a lng/lat coordinate.

    API Limitations

    1. The polygon query string has been limited to 5000 chars.
    2. The max north/south east/west distance accepted is 0.5 degrees.
    3. The max count of north/south east/west level 6 geohashes is 1000.
    warning

    WKT works on x/y planes. Therefore, the coordinates must be sent as lng/lat instead of lat/lng.

    ParameterStatusDescription
    latoptionalA decimal number between -90 and 90, representing the latitude.
    lngoptionalA decimal number between -180 and 180, representing the longitude.
    polygonoptionalList of 2D lng/lat points that define a 2D polygon, using the WKT representation
    radiusoptionalUsed to specify the maximum distance (in meters) away from the input lat/lng.
    Default: 5000 meters
    Maximum: 25000 meters
    limitoptionalThe limit of schools returned.
    Default: 30
    Maximum: 30
    languageoptionalString value representing the two letter ISO 361-1 language code to return the payload in, ex. fr
    Available: en and fr
    Default: en

    * Translations only available for the following fields in Canada:
    • school_attributes.levels
    • school_attributes.language
    • school_attributes.types
    • school_attributes.programs
    • catchments.*.level
    • catchments.*.program
    include_catchmentsoptionalDefaults to false. A boolean to get the school attendance catchments area or not. If true, the response will contain a catchments key that will contain the list of catchments. It may be an empty list when the catchments information is unavailable, which is the case for private schools and some public schools. The catchments key will not be defined if include_catchments is false.

    Usage examples

    require('node-fetch')('https://api.locallogic.co/v3/schools?' + new URLSearchParams({
    lat: 43.892958,
    lng: -79.426238,
    radius: 3000,
    limit: 10,
    include_catchments: true
    }), {
    method: 'GET',
    headers: {
    Accept: 'application/json',
    Authorization: 'Bearer eyJhbGciOiJ...'
    }
    })
    .then(response => response.json())
    .then(body => {
    console.log(body)
    })
    .catch(error => {
    console.log(error)
    })

    Response example

    {
    "data": {
    "primary_schools": [
    {
    "name": "Beverley Acres Public School",
    "address": "283 Neal Dr",
    "city": "Richmond Hill",
    "province": "ON",
    "postalcode": "L4C 3L3",
    "country": "Canada",
    "lat": 43.88923,
    "lng": -79.42313,
    "url": "http://beverleyacres.ps.yrdsb.ca/",
    "proximity": {
    "linear_distance": 30.46497578
    },
    "school_attributes": {
    "levels": [
    "elementary"
    ],
    "grades": "1-8",
    "languages": [
    "en"
    ],
    "programs": [
    "French Immersion"
    ],
    "types": [
    "public"
    ]
    },
    "school_board_attributes": {
    "name": "York Region DSB",
    "url": "http://www.yrdsb.ca/"
    },
    "catchments": [
    {
    "geometry": [
    [[[43.91933,-79.38866],[43.91673,-79.4003], ...
    ],
    "inside": true,
    "program": "french immersion",
    "grades": "4-8",
    "level": "elementary"
    }
    ]
    },
    // Plus other primary_schools
    ],
    "high_schools": [
    {
    "name": "Lauremont School ? Upper School",
    "address": "500 Elgin Mills Road E.",
    "city": "Richmond Hill",
    "province": "ON",
    "postalcode": "L4C 5G1",
    "country": "Canada",
    "lat": 43.893314,
    "lng": -79.426394,
    "url": "http://www.tmsschool.ca/",
    "proximity": {
    "linear_distance": 513.44274907
    },
    "school_attributes": {
    "levels": [
    "secondary",
    "elementary"
    ],
    "programs": [
    "Site Based Only"
    ],
    "types": [
    "private"
    ]
    },
    "school_board_attributes": {

    },
    "catchments": [

    ]
    },
    // Plus other high schools
    ]
    },
    "meta": {
    "message": "Successfully called v3/schools API.",
    "type": "LocalLogic.API.Success",
    "statusCode": 200,
    "counts": {
    "primary_schools": 10,
    "high_schools": 10
    }
    }
    }

    GET /v3/schools/{geog_id}

    Schools within and near a Local Logic geography can be accessed via Local Logic’s schools endpoint, documented below.

    Accepted values for geog_id are any geographies matching g10_*, g20_*, g30_*, g32_*, g35_*, g37_*, and g38_* (all geographies below a metro area). In order to obtain a geog_id, you can use the Local Logic Geographies endpoint

    Schools will be returned in order of least to greatest linear_distance_m away from the calculated centroid of the geography.

    GET /v3/schools/{geog_id}

    Header

    This API uses JWT token based authentication. This JWT Bearer token is what is used to populate the Authorization header below.

    Instructions on how to retrieve this token can be found at Getting Started.

    HeaderStatusDescription
    AuthorizationrequiredYour bearer token retrieved from our authorization API, ex. Bearer eyJhbGci...
    AcceptrequiredThe datatype to request, this API will return application/json.

    QueryString

    proximity.linear_distance data is provided in the response in meters distance from the centroid of the geography

    ParameterStatusDescription
    bufferoptionalThe distance beyond the borders of the geography to search for schools. This is helpful when the API consumer wants to search beyond the borders of a geography, for example to find schools within 2 km of a neighborhood.
    Default: 0
    Maximum: 10000 meters (or 6 miles)
    buffer_unitoptionalThe unit of distance beyond the borders of the geography to search for POIs. One of meter or mile.
    Default: meter
    languageoptionalString value representing the two letter ISO 361-1 language code to return the payload in, ex. fr

    Available: en and fr

    default: en

    * Translations only available for the following fields in Canada:
    • school_attributes.levels
    • school_attributes.language
    • school_attributes.types
    • school_attributes.programs
    • catchments.*.level
    • catchments.*.program
    include_catchmentsoptionalDefaults to false. A boolean to get the school attendance catchments area or not. If true, the response will contain a catchments key that will contain the list of catchments. It may be an empty list when the catchments information is unavailable, which is the case for private schools and some public schools. The catchments key will not be defined if include_catchments is false.
    limitoptionalThe limit of schools returned.
    Default: 30
    Maximum: 30

    Usage examples

      require('node-fetch')('https://api.locallogic.co/v3/schools/g10_f25en7xd', {
    method: 'GET',
    headers: {
    Accept: 'application/json',
    Authorization: 'Bearer eyJhbGciOiJ...'
    }
    })
    .then(response => response.json())
    .then(body => {
    console.log(body)
    })
    .catch(error => {
    console.log(error)
    })

    Response example

    {
    "data": {
    "primary_schools": [
    {
    "name": "École Baril",
    "address": "3603, rue Adam",
    "city": "Montreal",
    "province": "QC",
    "postalcode": "H1W1Z1",
    "country": "Canada",
    "lat": 45.544233,
    "lng": -73.541319,
    "proximity": {
    "linear_distance": 393.89550558
    },
    "school_attributes": {
    "levels": [
    "elementary",
    "preschool"
    ],
    "grades": "JK-6",
    "languages": [
    "fr"
    ],
    "programs": [
    "Regular"
    ],
    "types": [
    "public"
    ]
    },
    "school_board_attributes": {
    "name": "CSS de Montréal",
    "url": "http://www.cssdm.gouv.qc.ca/"
    }
    },
    {
    "name": "École Saint-Nom-de-Jésus",
    "address": "4131, rue Adam",
    "city": "Montreal",
    "province": "QC",
    "postalcode": "H1V1S8",
    "country": "Canada",
    "lat": 45.54931,
    "lng": -73.537271,
    "proximity": {
    "linear_distance": 397.25484873
    },
    "school_attributes": {
    "levels": [
    "elementary",
    "preschool"
    ],
    "grades": "JK-6",
    "languages": [
    "fr"
    ],
    "programs": [
    "Regular"
    ],
    "types": [
    "public"
    ]
    },
    "school_board_attributes": {
    "name": "CSS de Montréal",
    "url": "http://www.cssdm.gouv.qc.ca/"
    }
    },
    {
    "name": "École Saint-Jean-Baptiste-de-la-Salle",
    "address": "2355, boulevard Pie IX",
    "city": "Montreal",
    "province": "QC",
    "postalcode": "H1V2E6",
    "country": "Canada",
    "lat": 45.552143,
    "lng": -73.546324,
    "proximity": {
    "linear_distance": 599.59357222
    },
    "school_attributes": {
    "levels": [
    "elementary",
    "preschool"
    ],
    "grades": "JK-6",
    "languages": [
    "fr"
    ],
    "programs": [
    "Regular"
    ],
    "types": [
    "public"
    ]
    },
    "school_board_attributes": {
    "name": "CSS de Montréal",
    "url": "http://www.cssdm.gouv.qc.ca/"
    }
    },
    {
    "name": "École Maisonneuve",
    "address": "1680, avenue Morgan",
    "city": "Montreal",
    "province": "QC",
    "postalcode": "H1V2P9",
    "country": "Canada",
    "lat": 45.552135,
    "lng": -73.536484,
    "proximity": {
    "linear_distance": 642.27623557
    },
    "school_attributes": {
    "levels": [
    "elementary",
    "preschool"
    ],
    "grades": "JK-6",
    "languages": [
    "fr"
    ],
    "programs": [
    "Regular"
    ],
    "types": [
    "public"
    ]
    },
    "school_board_attributes": {
    "name": "CSS de Montréal",
    "url": "http://www.cssdm.gouv.qc.ca/"
    }
    },
    {
    "name": "École Notre-Dame-de-l'Assomption",
    "address": "2430, rue Darling",
    "city": "Montreal",
    "province": "QC",
    "postalcode": "H1W2X1",
    "country": "Canada",
    "lat": 45.543805,
    "lng": -73.552204,
    "proximity": {
    "linear_distance": 919.99774453
    },
    "school_attributes": {
    "levels": [
    "elementary",
    "preschool"
    ],
    "grades": "JK-6",
    "languages": [
    "fr"
    ],
    "programs": [
    "Regular"
    ],
    "types": [
    "public"
    ]
    },
    "school_board_attributes": {
    "name": "CSS de Montréal",
    "url": "http://www.cssdm.gouv.qc.ca/"
    }
    },
    {
    "name": "École Maisonneuve",
    "address": "4650, rue Ontario Est",
    "city": "Montreal",
    "province": "QC",
    "postalcode": "H1V1L2",
    "country": "Canada",
    "lat": 45.555905,
    "lng": -73.537242,
    "proximity": {
    "linear_distance": 974.52454894
    },
    "school_attributes": {
    "levels": [
    "elementary",
    "preschool"
    ],
    "grades": "JK-6",
    "languages": [
    "fr"
    ],
    "types": [
    "public"
    ]
    },
    "school_board_attributes": {
    "name": "CSS de Montréal",
    "url": "http://www.cssdm.gouv.qc.ca/"
    }
    },
    {
    "name": "École Sainte-Jeanne-d'Arc",
    "address": "3700, rue Sherbrooke Est",
    "city": "Montreal",
    "province": "QC",
    "postalcode": "H1X1Z8",
    "country": "Canada",
    "lat": 45.549194,
    "lng": -73.554424,
    "proximity": {
    "linear_distance": 994.59270588
    },
    "school_attributes": {
    "levels": [
    "elementary",
    "preschool"
    ],
    "grades": "JK-6",
    "languages": [
    "fr"
    ],
    "programs": [
    "Regular"
    ],
    "types": [
    "public"
    ]
    },
    "school_board_attributes": {
    "name": "CSS de Montréal",
    "url": "http://www.cssdm.gouv.qc.ca/"
    }
    }
    ],
    "high_schools": [
    {
    "name": "École Chomedey-de Maisonneuve (Chomedey-de-Maisonneuve)",
    "address": "1860, avenue Morgan",
    "city": "Montreal",
    "province": "QC",
    "postalcode": "H1V2R2",
    "country": "Canada",
    "lat": 45.552611,
    "lng": -73.538572,
    "proximity": {
    "linear_distance": 597.21570217
    },
    "school_attributes": {
    "levels": [
    "secondary"
    ],
    "grades": "7-11",
    "languages": [
    "fr"
    ],
    "programs": [
    "Regular"
    ],
    "types": [
    "public"
    ]
    },
    "school_board_attributes": {
    "name": "CSS de Montréal",
    "url": "http://www.cssdm.gouv.qc.ca/"
    }
    },
    {
    "name": "École Irénée-Lussier (Irénée-Lussier)",
    "address": "4100, rue Hochelaga",
    "city": "Montreal",
    "province": "QC",
    "postalcode": "H1V1B6",
    "country": "Canada",
    "lat": 45.552536,
    "lng": -73.546628,
    "proximity": {
    "linear_distance": 648.95499175
    },
    "school_attributes": {
    "levels": [
    "secondary"
    ],
    "grades": "7-11",
    "languages": [
    "fr"
    ],
    "types": [
    "public"
    ]
    },
    "school_board_attributes": {
    "name": "CSS de Montréal",
    "url": "http://www.cssdm.gouv.qc.ca/"
    }
    },
    {
    "name": "École Eulalie-Durocher",
    "address": "2455, avenue Letourneux",
    "city": "Montreal",
    "province": "QC",
    "postalcode": "H1V2N9",
    "country": "Canada",
    "lat": 45.554713,
    "lng": -73.546273,
    "proximity": {
    "linear_distance": 846.64028241
    },
    "school_attributes": {
    "levels": [
    "secondary"
    ],
    "grades": "7-11",
    "languages": [
    "fr"
    ],
    "types": [
    "public"
    ]
    },
    "school_board_attributes": {
    "name": "CSS de Montréal",
    "url": "http://www.cssdm.gouv.qc.ca/"
    }
    }
    ]
    },
    "meta": {
    "message": "Successfully called v3/schools API.",
    "type": "LocalLogic.API.Success",
    "statusCode": 200,
    "counts": {
    "primary_schools": 7,
    "high_schools": 3
    }
    }
    }

    SDK Implementations

    Schools is used by two Local Logic SDKs:

    SDKDescription
    Local Content SDKRetrieves the schools and their catchment areas for displaying on the SDK map.
    NeighborhoodMap SDKRetrieves the schools within and close to the neighborhood.

    Response codes

    When calling Local Logic’s API, you may receive an HTTP response code indicating an error or no data. These errors are explained below.

    In general, error codes starting with “4” are due to an invalid API call and can be fixed on your end, whereas error codes starting with “5” are due to server errors (that is, problems on our end). If you receive something not described here, please contact us at support@locallogic.co.

    204 - No Content

    This "error code" is not an error, and it happens when we don't have the requested data for a specific location. For example, if you send a lat/lng pair to fetch scores in uninhabited parts of northern Canada, we may return an empty 204 response as we recognize the location, but don't calculate scores that remotely so there is nothing to be returned.

    400 - BadRequest

    This error code happens when the request inputs are incorrect. Use the detail field of the response for clarification. Example:

    {
    "code": "LocalLogic.API.BadRequest",
    "detail": "ValidationErrors: AroundEndpoint is invalid:\n\tinclude is invalid: \"bad_input\" is not an acceptable value: \"groceries\", \"restaurants\", \"nightlife\", \"cafes\", \"shopping\", \"daycares\", \"primary_schools\", \"high_schools\""
    }

    401 - Unauthorized

    This error code happens when your API key cannot access specific resources or locations. For example, some API keys can only access certain countries / states / provinces. Feel free to contact us for more information.

    {
    "code": "LocalLogic.API.Unauthorized",
    "detail": "Your API KEY doesn't support this region"
    }

    403 - Forbidden

    This error code happens when you forgot to include security credentials with your request or you are requesting a parameter that you do not have access to.

    {
    "message": "Forbidden"
    }

    404 - NotFound

    This error code happens when we don’t have data for the requested location. For example, if you send a lat/lng pair for a location in Antarctica, we will return this error as we don’t have data for Antarctica (yet!).

    {
    "code": "LocalLogic.API.NotFound",
    "detail": "No Location Scores found for this location."
    }

    422 - Unprocessable Entity

    This error code is returned when the correct parameters have been sent however, the data they contain is not valid. For example, if you send a lat/lng pair and the latitude is invalid (ie. not in the range [-90, 90]) and/or the longitude is invalid (ie. not in the range [-180, 180]). The message returned will explain the specific issue with your parameters that makes them invalid.

    {
    "message": "Latitude must be within [-90, 90], Longitude must be within [-180, 180], Requires at least lat/lng pair, or geography_ids. None supplied.",
    "code": "LocalLogic.API.BadRequest",
    "statusCode": 422
    }

    429 - Too Many Requests

    This error code can be returned when you need to throttle your requests. Internally, we set limits that exceed all contractual limitations that could cause this error code to be returned. If you have questions or see this error, please contact us at support@locallogic.co.

    500 - ServerError

    This error code means that an error occurred on our end. Feel free to retry the same request to see if the problem persists. If you received a lot of these errors, please contact us at support@locallogic.co.

    {
    "code": "LocalLogic.API.ServerError",
    "detail": "No Location Scores found for this location."
    }

    502 - BadGateway

    This error code means that an error came from our cloud provider. Feel free to retry the same request to see if the problem persists.

    {
    "message": "Internal server error"
    }