1.0.0 • Published 5 years ago
within-canada v1.0.0
within-canada
Check if a Lat/Lng Coordinate is within the specified Canadian Province or Territory.
Examples
import canada from 'within-canada';
const toronto = { lat: 43.6532, lng: -79.3832 };
// Check for Toronto within Ontario (ON)
canada.on(toronto.lat, toronto.lng);
// trueHowever, it is much more space efficient to only request the function for the province/territory you actually need:
// get only the on() function (on its own)
import ontario from 'within-canada/on'
const toronto = { lat: 43.6532, lng: -79.3832 };
on(toronto.lat, toronto.lng);
// trueEach province/territory is available using the two character region code listed below.
API
The following functions are available, where lat and lng are of type Number:
on(lat, lng)returnstrueif the point is within Ontarioab(lat, lng)returnstrueif the point is within Albertabc(lat, lng)returnstrueif the point is within British Columbianl(lat, lng)returnstrueif the point is within Newfoundland and Labradorpe(lat, lng)returnstrueif the point is within Prince Edward Islandns(lat, lng)returnstrueif the point is within Nova Scotianb(lat, lng)returnstrueif the point is within New Brunswickqc(lat, lng)returnstrueif the point is within Québecmb(lat, lng)returnstrueif the point is within Manitobask(lat, lng)returnstrueif the point is within Saskatchewanyt(lat, lng)returnstrueif the point is within Yukon Territorynt(lat, lng)returnstrueif the point is within Northwest Territoriesnu(lat, lng)returnstrueif the point is within Nunavut
1.0.0
5 years ago