
Security News
Knip Hits 500 Releases with v5.62.0, Improving TypeScript Config Detection and Plugin Integrations
Knip hits 500 releases with v5.62.0, refining TypeScript config detection and updating plugins as monthly npm downloads approach 12M.
nearest-mrt
Advanced tools
A helper function for geospatial feature engineering. To find the nearest MRT station given a location's longitude & latitude.
Credits Singapore Land Authority (SLA) OneMap API service for location data.
npm install --save nearest-mrt
import getNearestMrt from 'nearest-mrt'
const target = [103.736083, 1.341832]
/**
* @param lnglat - coordinates of query location (required)
* @param excludeFuture - whether to exclude future stations ({boolean}, default false)
* @param radius - limit radius of search in meters ({numeric}, default 1000)
*/
const nearestMRT = getNearestMrt(target, false, 2000)
console.log(nearestMRT)
{
"query": {
"lnglat": [
103.736083,
1.341832
],
"excludeFuture": false,
"radius": 2000
},
"result": [
{
"rank": 1,
"station": {
"name": "CHINESE GARDEN",
"code": "EW25",
"longitude": 103.7327666,
"latitude": 1.3422449,
"x": 16809.69,
"y": 36044.45,
"line": {
"NSL": 0,
"EWL": 1,
"CGL": 0,
"NEL": 0,
"CCL": 0,
"DTL": 0,
"TEL": 0,
"JRL": 0
},
"operational": 1,
"interchange": 0,
"locations": [
{
"platform": "EW25",
"longitude": 103.7327663,
"latitude": 1.3422443,
"x": 16809.65,
"y": 36044.37
}
],
"transfers": []
},
"distance": 372
},
{
"rank": 2,
"station": {
"name": "JURONG EAST",
"code": "NS1 EW24 JE5",
"longitude": 103.7421539,
"latitude": 1.3332951,
"x": 17854.36,
"y": 35054.77,
"line": {
"NSL": 1,
"EWL": 1,
"CGL": 0,
"NEL": 0,
"CCL": 0,
"DTL": 0,
"TEL": 0,
"JRL": 2
},
"operational": 1,
"interchange": 1,
"locations": [
{
"platform": "NS1",
"longitude": 103.7422651,
"latitude": 1.3330741,
"x": 17866.73,
"y": 35030.34
},
{
"platform": "EW24",
"longitude": 103.7422651,
"latitude": 1.3330741,
"x": 17866.73,
"y": 35030.34
}
],
"transfers": [
{
"from": "NSL",
"to": "EWL",
"distance": 0
},
{
"from": "EWL",
"to": "NSL",
"distance": 0
}
]
},
"distance": 1161
},
{
"rank": 3,
"station": {
"name": "BUKIT BATOK",
"code": "NS2",
"longitude": 103.7495558,
"latitude": 1.348992,
"x": 18678.17,
"y": 36790.44,
"line": {
"NSL": 1,
"EWL": 0,
"CGL": 0,
"NEL": 0,
"CCL": 0,
"DTL": 0,
"TEL": 0,
"JRL": 0
},
"operational": 1,
"interchange": 0,
"locations": [
{
"platform": "NS2",
"longitude": 103.7495554,
"latitude": 1.3489914,
"x": 18678.13,
"y": 36790.36
}
],
"transfers": []
},
"distance": 1695
},
{
"rank": 4,
"station": {
"name": "LAKESIDE",
"code": "EW26",
"longitude": 103.7209246,
"latitude": 1.3442249,
"x": 15491.81,
"y": 36263.44,
"line": {
"NSL": 0,
"EWL": 1,
"CGL": 0,
"NEL": 0,
"CCL": 0,
"DTL": 0,
"TEL": 0,
"JRL": 0
},
"operational": 1,
"interchange": 0,
"locations": [
{
"platform": "EW26",
"longitude": 103.7209243,
"latitude": 1.3442242,
"x": 15491.77,
"y": 36263.36
}
],
"transfers": []
},
"distance": 1708
}
],
"accurateAsOf": 1539273600000
}
const nearestMRT = getNearestMrt(target, false, 2000)
console.log(nearestMRT.toFlatObjects())
console.log(nearestMRT.toTable())
console.log(nearestMRT.toCSV())
Sample flat object output:
Sample CSV output
FAQs
Helper function for geospatial feature engineering
The npm package nearest-mrt receives a total of 582 weekly downloads. As such, nearest-mrt popularity was classified as not popular.
We found that nearest-mrt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Knip hits 500 releases with v5.62.0, refining TypeScript config detection and updating plugins as monthly npm downloads approach 12M.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.