### Sample API Response Source: https://www.onemap.gov.sg/apidocs/themes Example JSON response structure returned by the Get Theme Info service. ```JSON { "Theme_Names": [ { "THEMENAME": "Kindergartens", "QUERYNAME": "kindergartens" } ] } ``` -------------------------------- ### Retrieve Theme Request Source: https://www.onemap.gov.sg/apidocs/themes Example of how to perform a GET request to the retrieveTheme endpoint using the Fetch API. ```JavaScript 1const url = "https://www.onemap.gov.sg/api/public/themesvc/retrieveTheme?queryName=dengue_cluster&extents=1.291789%2C103.7796402%2C1.3290461%2C103.8726032"; 2const authToken = '**********************'; // Replace with your access token 3 4fetch(url, { 5 method: 'GET', 6 headers: { 7 'Authorization': `${authToken}`, // API token for authorization 8 } 9}) 10.then(response => response.json()) // Parse response as JSON 11.then(data => console.log(data)) // Log the data to the console 12.catch(error => console.error('Error:', error)); // Log any errors ``` -------------------------------- ### Retrieve Theme Information Request Source: https://www.onemap.gov.sg/apidocs/themes Example of how to perform a GET request to the retrieveTheme endpoint using the Fetch API. ```javascript const url = "https://www.onemap.gov.sg/api/public/themesvc/retrieveTheme?queryName=dengue_cluster"; const authToken = '**********************'; // Replace with your access token fetch(url, { method: 'GET', headers: { 'Authorization': `${authToken}`, // API token for authorization } }) .then(response => response.json()) // Parse response as JSON .then(data => console.log(data)) // Log the data to the console .catch(error => console.error('Error:', error)); // Log any errors ``` -------------------------------- ### Request a BFA Route Source: https://www.onemap.gov.sg/apidocs/bfa Example of how to perform a GET request to the BFA routing service using the fetch API. ```javascript const url = "https://www.onemap.gov.sg/api/bfa/routingsvc/route?start=1.2871536,103.8147604&end=1.2874700,103.8183600"; const authToken = '**********************'; // Replace with your access token fetch(url, { method: 'GET', headers: { 'Authorization': `${authToken}`, // API token for authorization } }) .then(response => response.json()) // Parse response as JSON .then(data => console.log(data)) // Log the data to the console .catch(error => console.error('Error:', error)); // Log any errors ``` -------------------------------- ### Sample API Response Source: https://www.onemap.gov.sg/apidocs/themes Example JSON structure returned by the getAllThemesInfo endpoint. ```JSON { "Theme_Names": [ { "THEMENAME": "Kindergartens", "QUERYNAME": "kindergartens", "ICON": "school.gif", "EXPIRY_DATE": "31/12/2026", "PUBLISHED_DATE": "01/01/2012", "CATEGORY": "Education", "THEME_OWNER": "EARLY CHILDHOOD DEVELOPMENT AGENCY" }, { "THEMENAME": "Community Clubs", "QUERYNAME": "communityclubs", "ICON": "PA.jpg", "EXPIRY_DATE": "31/12/2022", "PUBLISHED_DATE": "01/01/2012", "CATEGORY": "Community", "THEME_OWNER": "PEOPLE'S ASSOCIATION" },..., { "THEMENAME": "CET Centres", "QUERYNAME": "cetcentres", "ICON": "WSQ.jpg", "EXPIRY_DATE": "31/12/2021", "PUBLISHED_DATE": "01/01/2012", "CATEGORY": "Education", "THEME_OWNER": "SINGAPORE WORKFORCE DEVELOPMENT AGENCY" } ] } ``` -------------------------------- ### API Response Examples Source: https://www.onemap.gov.sg/apidocs/docs/verifyingsearchapitoken JSON response structures for different authentication states. ```json 1{ 2 "error": "Authentication token missing. Please create an account and generate or renew your API Token.", 3 "found": 0, 4 "totalNumPages": 0, 5 "pageNum": 0, 6 "results": [] 7} ``` ```json 1{ 2 "error": "Authentication token expired. Tokens is valid for 3 days. Please implement automatic renewal to ensure your token remains valid.", 3 "found": 0, 4 "totalNumPages": 0, 5 "pageNum": 0, 6 "results": [] 7} ``` ```json 1{ 2 "error": "Invalid authentication token. Please register for an account and provide a valid API token.", 3 "found": 0, 4 "totalNumPages": 0, 5 "pageNum": 0, 6 "results": [] 7} ``` ```json 1{ 2 "found": 1, 3 "totalNumPages": 1, 4 "pageNum": 1, 5 "results": [ 6 { 7 "SEARCHVAL": "640 ROWELL ROAD SINGAPORE 200640", 8 "BLK_NO": "640", 9 "ROAD_NAME": "ROWELL ROAD", 10 "BUILDING": "NIL", 11 "ADDRESS": "640 ROWELL ROAD SINGAPORE 200640", 12 "POSTAL": "200640", 13 "X": "30381.1007417506", 14 "Y": "32195.1006872542", 15 "LATITUDE": "1.30743547948389", 16 "LONGITUDE": "103.854713903431" 17 } 18 ] 19} ``` -------------------------------- ### GET /api/bfa/routingsvc/route Source: https://www.onemap.gov.sg/apidocs/bfa Finds an optimal barrier-free access route between a starting location and a destination. ```APIDOC ## GET /api/bfa/routingsvc/route ### Description Finds optimal routes between two geographic coordinates, with support for barrier-free access (BFA) routing for accessibility needs. ### Method GET ### Endpoint /api/bfa/routingsvc/route ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **start** (string) - Required - The start point in WGS84 latitude, longitude format. - **end** (string) - Required - The end point in WGS84 latitude, longitude format. ### Request Example GET /api/bfa/routingsvc/route?start=1.2871536,103.8147604&end=1.2874700,103.8183600 ### Response #### Success Response (200) - **status_message** (string) - Status message of the request. - **route_geometry** (string) - Encoded geometry string of the route. - **status** (integer) - Status code. - **route_instructions** (array) - Detailed turn-by-turn instructions. - **route_name** (array) - Names of the paths used. - **route_summary** (object) - Summary containing start/end points, total time, and total distance. - **legs** (array) - Detailed segments of the route. #### Response Example { "status_message": "Found route between points", "route_geometry": "{kzFyisxRa@?C??IIAA?[?Q?DK?G@KFmC?_@D{A@g@DY@}@@]@[?s@@O?E@ET@@c@?]a@?B}@", "status": 0, "route_summary": { "total_time": 342, "total_distance": 476 } } ``` -------------------------------- ### Sample API Response Source: https://www.onemap.gov.sg/apidocs/populationquery Example of the JSON structure returned by the household structure API. ```JSON [ { "planning_area": "Bedok", "no_family_nucleus": 17526, "ofn_1_gen": 11330, "ofn_2_gen": 50450, "ofn_3_more_gen": 5758, "tfn_1to2_gen": 1435, "tfn_3_more_gen": 4412, "three_more_fam_nucleus": 313, "year": 2010 } ] ``` -------------------------------- ### GET /api/public/themesvc/retrieveTheme Source: https://www.onemap.gov.sg/apidocs/themes Retrieves theme information based on the provided query name. ```APIDOC ## GET /api/public/themesvc/retrieveTheme ### Description Retrieves detailed information for a specific theme. The query name must be provided as a parameter. ### Method GET ### Endpoint /api/public/themesvc/retrieveTheme ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **queryName** (string) - Required - Enables users to retrieve theme information. Themes' query names can be retrieved using Get All Themes Info service. ### Request Example GET /api/public/themesvc/retrieveTheme?queryName=dengue_cluster ### Response #### Success Response (200) - **SrchResults** (array) - List of theme data objects. #### Response Example { "SrchResults": [ { "FeatCount": 40, "Theme_Name": "Dengue Clusters", "Category": "Health", "Owner": "NATIONAL ENVIRONMENT AGENCY", "DateTime": "2023-07-11T15:54:59+00:00" } ] } ``` -------------------------------- ### GET /api/public/themesvc/getThemeInfo Source: https://www.onemap.gov.sg/apidocs/themes Retrieves theme information based on the provided query name. ```APIDOC ## GET /api/public/themesvc/getThemeInfo ### Description Searches for themes using a query name and returns the theme information. ### Method GET ### Endpoint /api/public/themesvc/getThemeInfo ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **queryName** (string) - Required - Enables users to retrieve theme information. ### Request Example GET /api/public/themesvc/getThemeInfo?queryName=kindergartens ### Response #### Success Response (200) - **Theme_Names** (array) - A list of theme objects containing THEMENAME and QUERYNAME. #### Response Example { "Theme_Names": [ { "THEMENAME": "Kindergartens", "QUERYNAME": "kindergartens" } ] } ``` -------------------------------- ### GET /api/public/popapi/getAllPlanningarea Source: https://www.onemap.gov.sg/apidocs/planningarea Retrieves all planning area polygons of Singapore in JSON format. ```APIDOC ## GET /api/public/popapi/getAllPlanningarea ### Description Retrieves all planning area polygons of Singapore in JSON format. Users can specify a year to get polygons for a specific master plan; otherwise, the latest data is returned. ### Method GET ### Endpoint /api/public/popapi/getAllPlanningarea ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **year** (string) - Optional - If not specified, the latest data will be provided. Available values: 1998, 2008, 2014, and 2019. ### Response #### Success Response (200) - **SearchResults** (array) - List of planning area objects containing names and geojson data. ``` -------------------------------- ### GET /api/public/popapi/getHouseholdMonthlyIncomeWork Source: https://www.onemap.gov.sg/apidocs/populationquery Retrieves monthly household income data for a specified planning area and year. ```APIDOC ## GET /api/public/popapi/getHouseholdMonthlyIncomeWork ### Description Retrieves data related to monthly household income for a given planning area name and year. ### Method GET ### Endpoint /api/public/popapi/getHouseholdMonthlyIncomeWork ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **planningArea** (string) - Required - Planning area name. - **year** (string) - Required - Years available are 2000, 2010, 2015, and 2020. ### Response #### Success Response (200) - **planning_area** (string) - The planning area name. - **total** (number) - Total households. - **year** (number) - The year of the data. #### Response Example [ { "planning_area": "Bedok", "total": 97553, "year": 2020 } ] ``` -------------------------------- ### Node.js Axios Authentication Tests Source: https://www.onemap.gov.sg/apidocs/docs/verifyingsearchapitoken Examples demonstrating how to handle various authentication scenarios using Axios in Node.js. ```javascript 1const axios = require("axios"); 2 3async function testMissingToken() { 4 try { 5 const response = await axios.get( 6 "https://www.onemap.gov.sg/api/common/elastic/search?searchVal=200640&returnGeom=Y&getAddrDetails=Y&pageNum=1" 7 ); 8 console.log(response.data); 9 } catch (err) { 10 console.error("Status:", err.response?.status); 11 console.error("Data:", err.response?.data); 12 } 13} 14 15testMissingToken(); ``` ```javascript 1async function testExpiredToken() { 2 try { 3 const response = await axios.get( 4 "https://www.onemap.gov.sg/api/common/elastic/search?searchVal=200640&returnGeom=Y&getAddrDetails=Y&pageNum=1", 5 { 6 headers: { Authorization: "" } 7 } 8 ); 9 console.log(response.data); 10 } catch (err) { 11 console.error("Status:", err.response?.status); 12 console.error("Data:", err.response?.data); 13 } 14} 15 16testExpiredToken(); ``` ```javascript 1async function testInvalidToken() { 2 try { 3 const response = await axios.get( 4 "https://www.onemap.gov.sg/api/common/elastic/search?searchVal=200640&returnGeom=Y&getAddrDetails=Y&pageNum=1", 5 { 6 headers: { Authorization: "invalid12345" } 7 } 8 ); 9 console.log(response.data); 10 } catch (err) { 11 console.error("Status:", err.response?.status); 12 console.error("Data:", err.response?.data); 13 } 14} 15 16testInvalidToken(); ``` ```javascript 1async function testValidToken() { 2 try { 3 const response = await axios.get( 4 "https://www.onemap.gov.sg/api/common/elastic/search?searchVal=200640&returnGeom=Y&getAddrDetails=Y&pageNum=1", 5 { 6 headers: { Authorization: "" } 7 } 8 ); 9 console.log("Status:", response.status); 10 console.log("Data:", response.data); 11 } catch (err) { 12 console.error(err.response?.data || err.message); 13 } 14} 15 16testValidToken(); ``` -------------------------------- ### Reverse Geocode Request Source: https://www.onemap.gov.sg/apidocs/reverseGeocode Example of performing a GET request to the Reverse Geocode endpoint using JavaScript. ```JavaScript const url = "https://www.onemap.gov.sg/api/public/revgeocodexy?location=24291.97788882387%2C31373.0117224489&buffer=40&addressType=All"; const authToken = '**********************'; // Replace with your access token fetch(url, { method: 'GET', headers: { 'Authorization': `${authToken}`, // API token for authorization } }) .then(response => response.json()) // Parse response as JSON .then(data => console.log(data)) // Log the data to the console .catch(error => console.error('Error:', error)); // Log any errors ``` -------------------------------- ### GET /api/public/routingsvc/route Source: https://www.onemap.gov.sg/apidocs/routing Retrieves travel paths between a start and end location based on the specified route type. ```APIDOC ## GET /api/public/routingsvc/route ### Description Retrieves travel paths between a start and end location. Supports public transport, driving, walking, and cycling. Returns total time in seconds, total distance in metres, and encoded route geometry. ### Method GET ### Endpoint /api/public/routingsvc/route ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **start** (string) - Required - The start point in WGS84 latitude, longitude format. - **end** (string) - Required - The end point in WGS84 latitude, longitude format. - **routeType** (string) - Required - Route types available: walk, drive, pt, and cycle. - **date** (string) - Required - Date of the selected start point in MM-DD-YYYY. - **time** (string) - Required - Time of the selected start point in HH:MM:SS (24-hour clock). - **mode** (string) - Required - Mode of public transport: transit, bus, rail. - **maxWalkDistance** (string) - Optional - The maximum walking distance in metres. - **numItineraries** (string) - Optional - Limits the number of return results: 1 to 3. ### Response #### Success Response (200) - **requestParameters** (object) - Echoes the parameters used for the request. - **plan** (object) - Contains the routing plan, including duration, start/end times, and itineraries. ``` -------------------------------- ### Define Environment Variables Source: https://www.onemap.gov.sg/apidocs/docs/tokenmanagement Store sensitive credentials and configuration in environment variables. ```text ONEMAP_API_EMAIL=your_email@example.com ONEMAP_API_PASSWORD=your_password ONEMAP_BASE_URL=https://www.onemap.gov.sg ``` -------------------------------- ### GET /api/public/routingsvc/route Source: https://www.onemap.gov.sg/apidocs/routing Retrieves path options for walking, driving, cycling, or public transport between a specified start and end point. ```APIDOC ## GET /api/public/routingsvc/route ### Description Retrieves walking, driving, cycling, or public transport path options for given start and end coordinates. ### Method GET ### Endpoint /api/public/routingsvc/route ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **start** (string) - Required - The start point in WGS84 latitude, longitude format. - **end** (string) - Required - The end point in WGS84 latitude, longitude format. - **routeType** (string) - Required - Route types available: walk, drive, pt, and cycle. ### Request Example GET /api/public/routingsvc/route?start=1.319728,103.8421&end=1.319728905,103.8421581&routeType=walk ### Response #### Success Response (200) - **status_message** (string) - Status message of the request. - **route_geometry** (string) - Encoded geometry of the route. - **status** (integer) - Status code. - **route_instructions** (array) - List of turn-by-turn instructions. - **route_name** (array) - List of route names. - **route_summary** (object) - Summary containing total_time and total_distance. #### Response Example { "status_message": "Found route between points", "route_geometry": "{u`GktxxR?G", "status": 0, "route_instructions": [ ["Left", "", 5, "1.319498,103.842142", 3, "5m", "East", "North", "walking", "Head East"] ], "route_summary": { "total_time": 3, "total_distance": 5 } } ``` -------------------------------- ### GET /api/common/convert/3414to3857 Source: https://www.onemap.gov.sg/apidocs/coordinate Converts coordinates from EPSG:3414 to EPSG:3857. ```APIDOC ## GET /api/common/convert/3414to3857 ### Description Converts coordinates from EPSG:3414 to EPSG:3857. ### Method GET ### Endpoint /api/common/convert/3414to3857 ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **Y** (string) - Required - Y coordinates in SVY21 format. - **X** (string) - Required - X coordinates in SVY21 format. ### Response #### Success Response (200) - **Y** (number) - Converted Y coordinate in EPSG:3857 - **X** (number) - Converted X coordinate in EPSG:3857 #### Response Example { "Y": 146924.61623595929, "X": 11559656.199673364 } ``` -------------------------------- ### Routing API Response Example Source: https://www.onemap.gov.sg/apidocs/routing A sample JSON response object representing a portion of a travel itinerary, including transit leg details and walking directions. ```json { "startTime": 1762746518000, "endTime": 1762746729000, "departureDelay": 0, "arrivalDelay": 0, "realTime": false, "distance": 2251.66, "generalizedCost": 1146, "pathway": false, "mode": "SUBWAY", "transitLeg": true, "route": "CC", "agencyName": "SMRT Corporation", "agencyUrl": "http://www.smrt.com.sg/", "agencyTimeZoneOffset": 28800000, "routeType": 1, "routeId": "CC", "interlineWithPreviousLeg": false, "agencyId": "1:SMRT", "tripId": "CC-2-3045", "serviceDate": "2025-11-10", "from": { "name": "HARBOURFRONT MRT STATION", "stopId": "FERRY:CC29", "stopCode": "CC29", "lon": 103.8215302, "lat": 1.2653894, "arrival": 1762746334000, "departure": 1762746518000, "stopIndex": 0, "stopSequence": 1, "vertexType": "TRANSIT" }, "to": { "name": "LABRADOR PARK MRT STATION", "stopId": "FERRY:CC27", "stopCode": "CC27", "lon": 103.8030136, "lat": 1.2723092, "arrival": 1762746729000, "departure": 1762746729000, "stopIndex": 2, "stopSequence": 3, "vertexType": "TRANSIT" }, "intermediateStops": [ { "name": "TELOK BLANGAH MRT STATION", "stopId": "FERRY:CC28", "stopCode": "CC28", "lon": 103.8097616, "lat": 1.2707065, "arrival": 1762746636000, "departure": 1762746666000, "stopIndex": 1, "stopSequence": 2, "vertexType": "TRANSIT" } ], "legGeometry": { "points": "ucvFistxRJfD?lBG~@Y|Aa@hAk@`A}@hAyB~B{ApCSb@]z@oAdDWn@q@|AU`@sHzNa@|@Y`AQdAIdASrE???BKpCIbBCt@Et@M`AQ`AS~@m@`BSb@c@x@s@tA_@t@_@~@Qn@Kh@MnACb@E|@GnB?N", "length": 44 }, "steps": [], "routeShortName": "CC", "routeLongName": "CIRCLE LINE", "duration": 211 } ``` -------------------------------- ### GET /api/common/convert/3857to4326 Source: https://www.onemap.gov.sg/apidocs/coordinate Converts coordinates from EPSG:3857 to EPSG:4326 (WGS84). ```APIDOC ## GET /api/common/convert/3857to4326 ### Description Converts coordinates from EPSG:3857 to EPSG:4326 (WGS84). ### Method GET ### Endpoint /api/common/convert/3857to4326 ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **Y** (string) - Required - Y coordinates in SVY21 format. - **X** (string) - Required - X coordinates in SVY21 format. ### Request Example GET /api/common/convert/3857to4326?Y=146924.54200324757&X=11559656.16256661 ### Response #### Success Response (200) - **latitude** (number) - The converted latitude. - **longitude** (number) - The converted longitude. #### Response Example { "latitude": 1.3197289050000036, "longitude": 103.8421581 } ``` -------------------------------- ### Retrieve Tenancy Data Request Source: https://www.onemap.gov.sg/apidocs/populationquery Example request to the Tenancy API using the fetch API. ```JavaScript const url = "https://www.onemap.gov.sg/api/public/popapi/getTenancy?planningArea=Bedok&year=2020"; const authToken = '**********************'; // Replace with your access token fetch(url, { method: 'GET', headers: { 'Authorization': `${authToken}`, // API token for authorization } }) .then(response => response.json()) // Parse response as JSON .then(data => console.log(data)) // Log the data to the console .catch(error => console.error('Error:', error)); // Log any errors ``` -------------------------------- ### GET /api/common/convert/3857to3414 Source: https://www.onemap.gov.sg/apidocs/coordinate Converts coordinates from EPSG:3857 to EPSG:3414 (SVY21). ```APIDOC ## GET /api/common/convert/3857to3414 ### Description Converts coordinates from EPSG:3857 to EPSG:3414 (SVY21). ### Method GET ### Endpoint /api/common/convert/3857to3414 ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **Y** (string) - Required - Y Coordinates in SVY21 format. - **X** (string) - Required - X Coordinates in SVY21 format. ### Response #### Success Response (200) - **Y** (number) - Converted Y coordinate - **X** (number) - Converted X coordinate #### Response Example { "Y": 33554.4360965483, "X": 28983.75169436287 } ``` -------------------------------- ### Routing API Response Example Source: https://www.onemap.gov.sg/apidocs/routing This snippet illustrates the structure of a route response, containing walking and subway transit legs with associated geometry and stop details. ```json "generalizedCost": 4397, 364 "pathway": false, 365 "mode": "WALK", 366 "transitLeg": false, 367 "route": "", 368 "agencyTimeZoneOffset": 28800000, 369 "interlineWithPreviousLeg": false, 370 "from": { 371 "name": "Origin", 372 "lon": 103.8551479, 373 "lat": 1.3081592, 374 "departure": 1762744991000, 375 "vertexType": "NORMAL" 376 }, 377 "to": { 378 "name": "FARRER PARK MRT STATION", 379 "stopId": "FERRY:NE8", 380 "stopCode": "NE8", 381 "lon": 103.854361, 382 "lat": 1.3126039, 383 "arrival": 1762745620000, 384 "departure": 1762745620000, 385 "vertexType": "TRANSIT" 386 }, 387 "legGeometry": { 388 "points": "co~Fme{xR??UMEACDGJCFOQE?[QEC_@Q?CQKE?[QYJi@_@I@MSE?ACa@[IEi@c@ECIG?AGCWUKGA?WQK?C?UPQLm@h@m@f@IJg@b@ED[VCBGF?BUPA@A??@EBu@b@q@^E@CBWNABAD@B?BLLSPNLUT", 389 "length": 64 390 }, 391 "steps": [ 392 { 393 "distance": 669.64, 394 "relativeDirection": "DEPART", 395 "streetName": "path", 396 "absoluteDirection": "NORTHEAST", 397 "stayOn": false, 398 "area": false, 399 "bogusName": true, 400 "lon": 103.8551107, 401 "lat": 1.3081822, 402 "elevation": "", 403 "walkingBike": false 404 } 405 ], 406 "rentedBike": false, 407 "walkingBike": false, 408 "duration": 629 409 }, 410 { 411 "startTime": 1762745620000, 412 "endTime": 1762746334000, 413 "departureDelay": 0, 414 "arrivalDelay": 0, 415 "realTime": false, 416 "distance": 7115.75, 417 "generalizedCost": 1389, 418 "pathway": false, 419 "mode": "SUBWAY", 420 "transitLeg": true, 421 "route": "NE", 422 "agencyName": "SBS Transit", 423 "agencyUrl": "http://www.sbstransit.com.sg/", 424 "agencyTimeZoneOffset": 28800000, 425 "routeType": 1, 426 "routeId": "NE", 427 "interlineWithPreviousLeg": false, 428 "agencyId": "1:SBST", 429 "tripId": "NE-2-3023", 430 "serviceDate": "2025-11-10", 431 "from": { 432 "name": "FARRER PARK MRT STATION", 433 "stopId": "FERRY:NE8", 434 "stopCode": "NE8", 435 "lon": 103.854361, 436 "lat": 1.3126039, 437 "arrival": 1762745620000, 438 "departure": 1762745620000, 439 "stopIndex": 10, 440 "stopSequence": 11, 441 "vertexType": "TRANSIT" 442 }, 443 "to": { 444 "name": "HARBOURFRONT MRT STATION", 445 "stopId": "FERRY:NE1", 446 "stopCode": "NE1", 447 "lon": 103.8215302, 448 "lat": 1.2653894, 449 "arrival": 1762746334000, 450 "departure": 1762746518000, 451 "stopIndex": 16, 452 "stopSequence": 17, 453 "vertexType": "TRANSIT" 454 }, 455 "intermediateStops": [ 456 { 457 "name": "LITTLE INDIA MRT STATION", 458 "stopId": "FERRY:NE7", 459 "stopCode": "NE7", 460 "lon": 103.8496464, 461 "lat": 1.3067411, 462 "arrival": 1762745684000, 463 "departure": 1762745714000, 464 "stopIndex": 11, 465 "stopSequence": 12, 466 "vertexType": "TRANSIT" 467 }, 468 { 469 "name": "DHOBY GHAUT MRT STATION", 470 "stopId": "FERRY:NE6", 471 "stopCode": "NE6", 472 "lon": 103.8453759, 473 "lat": 1.2996206, 474 "arrival": 1762745790000, 475 "departure": 1762745820000, 476 "stopIndex": 12, 477 "stopSequence": 13, 478 "vertexType": "TRANSIT" 479 }, 480 { 481 "name": "CLARKE QUAY MRT STATION", 482 "stopId": "FERRY:NE5", 483 "stopCode": "NE5", 484 "lon": 103.8466109, 485 "lat": 1.2887102, 486 "arrival": 1762745928000, 487 "departure": 1762745958000, 488 "stopIndex": 13, 489 "stopSequence": 14, 490 "vertexType": "TRANSIT" 491 }, 492 { 493 "name": "CHINATOWN MRT STATION", 494 "stopId": "FERRY:NE4", 495 "stopCode": "NE4", 496 "lon": 103.8432502, 497 "lat": 1.2840949, 498 "arrival": 1762746006000, 499 "departure": 1762746036000, 500 "stopIndex": 14, 501 "stopSequence": 15, 502 "vertexType": "TRANSIT" 503 }, 504 { 505 "name": "OUTRAM PARK MRT STATION", 506 "stopId": "FERRY:NE3", 507 "stopCode": "NE3", 508 "lon": 103.8395135, 509 "lat": 1.2797397, 510 "arrival": 1762746092000, 511 "departure": 1762746122000, 512 "stopIndex": 15, 513 "stopSequence": 16, 514 "vertexType": "TRANSIT" 515 } 516 ], 517 "legGeometry": { 518 "points": "mj_G_a{xRs@w@z@~@|DdE??DFFDDDDDDFDD??DDDDFDDFJHHHHFFDDDFDDDFDDDFBDDFD??FD`FlD@BB@BBB@B@@BB@B@BBB@VRHDBBB@B@BBB@B@@@BBB@B@??BB??B@@@B@BBB@B@BB@@B@JFVPBBB@BB@@B@BBB@@@BBB@nFxDjBrA??fChBnBtABBB@@@BBB@B@@BB@??BBB@XPVPXPXPZPXNZNRJB@B@B@B@B@B@B@BBB@??B@??fXvLrAl@??f@T??JDHDJDJDHDFBB@HDHB@@JBJDHBJDJBJBJBJBJBJBJBJ@LBJ@J@J@J@L@J@J@J?L@J?J?L?J?J?L?J?JAJ?LAJ?JALAJAJAJCJAJCLAJCJCJCJCJCHCJCJEJC@AHCJEJEHEJEJEHEJEHEJEdNoGHEJEHEJEHEJEJEHEJCJEFCJELCJEJCJCJCJCLCJCJALCJALAJALAJALAJALAJ?L?JAL?J?L?J?L@L?J@L?J@L@J@L@J@JBL@JBJ@JBJBJ@JBJBJBLBHBzBf@NB??zD~@JBJBJDD@JDJBHDJDJD^VXPd@Zj@j@j@h@X\|@`A|@r@TTTTb@^JHpCzB`Av@??zBjB|AnADBBBDBBBBBDDBBDBBBDBPLRNTNPJBBDBDBBBD@BBDBDBBBD@t@d@DBBBDBD@BBDBBBD@DBBB@@RLTNRN@?A?SOA?@?RNRNRNPPRNPPPPNN@@DBBBBD@@@@BBDBFHBBBD??nBtBNP??`HpHFFDDDDDFDDDDDFDDDDDFBBHJHJFLHJHJFLFJHLBFBFDDBFBFDFBFBFBFBFR`@BF??BF??DFBFBFBFDFBDBFDFFJFLHLFJHJHJHLHJHJHJHHJJ@@DDDDDDDFFDDDDDFDDDDD??bJjIB@@BB@BB@@BB@@BBB@@BVRVTVRXPRPB@B@??BB@@BBB@B@BB@@B@hBlADBBBDBBBDBBBDBB@DBBB@@RNRNRNPPPNPPDBBBBBBDDBBBBBBBBDDB??t]|]HFFHFFHHFFFHHHFFFHFHDDFHFJFHFHFHDJFHDJDHFJDJDJDHDJBJDJDJBJBJDJBLBJ@JBJBL@JBJ@L@J@J@L@J@J@J?L@J?J@J@L???J\xK", 519 "length": 522 520 }, 521 "steps": [], 522 ``` -------------------------------- ### Retrieve Income from Work Data Source: https://www.onemap.gov.sg/apidocs/populationquery Example request to fetch income data for a specific planning area and year using the fetch API. ```JavaScript const url = "https://www.onemap.gov.sg/api/public/popapi/getIncomeFromWork?planningArea=Bedok&year=2010"; const authToken = '**********************'; // Replace with your access token fetch(url, { method: 'GET', headers: { 'Authorization': `${authToken}`, // API token for authorization } }) .then(response => response.json()) // Parse response as JSON .then(data => console.log(data)) // Log the data to the console .catch(error => console.error('Error:', error)); // Log any errors ``` -------------------------------- ### GET /api/common/convert/4326to3857 Source: https://www.onemap.gov.sg/apidocs/coordinate Converts coordinates from EPSG:4326 to EPSG:3857 format. ```APIDOC ## GET /api/common/convert/4326to3857 ### Description Converts latitude and longitude coordinates from EPSG:4326 (WGS84) to EPSG:3857. ### Method GET ### Endpoint /api/common/convert/4326to3857 ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **latitude** (string) - Required - Latitude coordinates in WGS84 format. - **longitude** (string) - Required - Longitude coordinates in WGS84 format. ### Request Example GET /api/common/convert/4326to3857?latitude=1.319728905&longitude=103.8421581 ### Response #### Success Response (200) - **X** (number) - The converted X coordinate. - **Y** (number) - The converted Y coordinate. #### Response Example { "Y": 146924.54200324757, "X": 11559656.16256661 } ``` -------------------------------- ### GET /api/common/convert/3414to4326 Source: https://www.onemap.gov.sg/apidocs/coordinate Converts coordinates from EPSG:3414 (SVY21) to EPSG:4326 (WGS84). ```APIDOC ## GET /api/common/convert/3414to4326 ### Description This API converts coordinates from EPSG:3414 to EPSG:4326. ### Method GET ### Endpoint /api/common/convert/3414to4326 ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **Y** (string) - Required - Y Coordinates in SVY21 format. - **X** (string) - Required - X Coordinates in SVY21 format. ### Request Example GET /api/common/convert/3414to4326?X=28983.788791079794&Y=33554.5098132845 ### Response #### Success Response (200) - **latitude** (number) - The converted latitude in WGS84. - **longitude** (number) - The converted longitude in WGS84. #### Response Example { "latitude": 1.3197295716669164, "longitude": 103.84215843333567 } ``` -------------------------------- ### Sample API Response Source: https://www.onemap.gov.sg/apidocs/populationquery Example JSON structure returned by the dwelling type household data endpoint. ```json [ { "planning_area": "Bedok", "hdb_1_and_2_room_flats": 5391, "hdb_3_room_flats": 22903, "hdb_4_room_flats": 22045, "hdb_5_room_and_executive_flats": 14226, "condominiums_and_other_apartments": 20922, "landed_properties": 11545, "others": 519, "year": 2020, "total_hdb": 64565 } ] ``` -------------------------------- ### GET /api/public/popapi/getTenancy Source: https://www.onemap.gov.sg/apidocs/populationquery Retrieves tenancy data for a specified planning area and year. ```APIDOC ## GET /api/public/popapi/getTenancy ### Description Retrieves data related to tenancy for the given planning area name and year. ### Method GET ### Endpoint /api/public/popapi/getTenancy ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **planningArea** (string) - Required - Planning area name. - **year** (string) - Required - Years available are 2000, 2010, 2015, and 2020. ### Request Example GET /api/public/popapi/getTenancy?planningArea=Bedok&year=2020 ### Response #### Success Response (200) - **planning_area** (string) - Planning area name - **owner** (number) - Number of owners - **tenant** (number) - Number of tenants - **others** (number) - Other tenancy counts - **year** (number) - Year of data #### Response Example [ { "planning_area": "Bedok", "owner": 85033, "tenant": 11127, "others": 1391, "year": 2020 } ] ``` -------------------------------- ### GET /api/public/popapi/getReligion Source: https://www.onemap.gov.sg/apidocs/populationquery Retrieves religion data for a specified planning area and year. ```APIDOC ## GET /api/public/popapi/getReligion ### Description Retrieves data related to religion for a given planning area name and year. ### Method GET ### Endpoint /api/public/popapi/getReligion ### Parameters #### Header Parameters - **Authorization** (string) - Required - API token provided by the Authentication Service. #### Query Parameters - **planningArea** (string) - Required - Planning area name. - **year** (string) - Required - Years available are 2000, 2010, 2015, and 2020. ### Request Example GET /api/public/popapi/getReligion?planningArea=Bedok&year=2020 ### Response #### Success Response (200) - **planning_area** (string) - The name of the planning area. - **no_religion** (number) - Count of population with no religion. - **buddhism** (number) - Count of population identifying as Buddhist. - **taoism** (number) - Count of population identifying as Taoist. - **islam** (number) - Count of population identifying as Muslim. - **hinduism** (number) - Count of population identifying as Hindu. - **sikhism** (number) - Count of population identifying as Sikh. - **catholic_christian** (number) - Count of population identifying as Catholic Christian. - **other_christians** (number) - Count of population identifying as other Christians. - **other_religions** (number) - Count of population identifying with other religions. - **year** (number) - The year of the data. #### Response Example [ { "planning_area": "Bedok", "no_religion": 47193, "buddhism": 69927, "taoism": 18890, "islam": 40660, "hinduism": 10321, "sikhism": 1058, "catholic_christian": 20874, "other_christians": 29299, "other_religions": 511, "year": 2020 } ] ```