Skip to content

Straight-forward API server to convert rain area radar images (Singapore) to GeoJSON

Notifications You must be signed in to change notification settings

cheeaun/rain-geojson-sg

Repository files navigation

Rain GeoJSON SG

Straight-forward API server to convert rain area radar images (Singapore) to GeoJSON.

Convert rain area radar image to GeoJSON

  • 50-km radar images: Weather.gov.sg
  • 70-km radar images: MyENV apps
  • Radar images are generated every 5 minutes.
  • Raster image is converted to GeoJSON, pixel by pixel. From pixels to polygons.
  • Polygons in GeoJSON are grouped by color/intensity into MultiPolygons. Adjacent polygons are unioned/combined.
  • Intensity values are improvised to be 0-100. These may not be standard/scientific values. They are reverse-engineered from the rain intensity color scheme (Light → Moderate → Heavy).
  • Only the latest GeoJSON data is cached and will updated every few minutes.

🚧 UPDATE: GeoJSON output is not used anymore 🚧


🚧 Current root (/) API calls runs on micro which is not very "serverless". This endpoint will be deprecated soon.

🚧 A new set of APIs have been added as /api endpoints which runs better as serverless functions.

Technicalities

Node.js and Vercel is required to run this server. These are the commands:

  • npm i - install all dependencies
  • npm run dev - run a development server
  • npm start - run a production server
  • vercel dev - runs local server

The URLs:

  • / - return a basic JSON of basic information
  • /now - return the GeoJSON result of latest radar image
  • /api/observations - returns weather observations data (temperature, relative humidity, wind direction, etc)
  • /api/rainarea - returns precipitation radar data.

Copyright/License