Datasets – Singapore National Environment Agency (NEA)

Meteorological services (NEA)
Provides timely weather information to support public safety and socio-economic activities. Issues haze alerts and provides vital meteorological services to the aviation and maritime communities.

About the National Environment Agency
Formed on 1 July 2002, the National Environment Agency (NEA) is the leading public organization responsible for improving and sustaining a clean and green environment in Singapore. The NEA develops and spearheads environmental initiatives and programmes through its partnership with the People, Public and Private sectors. It is committed to motivating every individual to take up environmental ownership and to care for the environment as a way of life.
By protecting Singapore’s resources from pollution, maintaining a high level of public health and providing timely meteorological information, the NEA endeavours to ensure sustainable development and a quality living environment for present and future generations.

Datasets Available

Dataset Description URL Metadata
Nowcast Current weather conditions for various areas in Singapore https://api.projectnimbus.org/neaodataservice.svc/NowcastSet Click Here
Forecast Weather forecast for various areas in Singapore https://api.projectnimbus.org/neaodataservice.svc/ForecastSet Click Here
Aircon Inverter Dataset for Airconditioners with inverter https://api.projectnimbus.org/neaodataservice.svc/AirconInverterSet Click Here
Aircon Non-Inverter Dataset for Airconditioners without inverter https://api.projectnimbus.org/neaodataservice.svc/AirconNonInverterSet Click Here
Clothes Dryer Dataset for Clothes Dryer https://api.projectnimbus.org/neaodataservice.svc/ClothesDryerSet Click Here
Events List of events organised by NEA https://api.projectnimbus.org/neaodataservice.svc/EventSet Click Here
Refrigerators Dataset of Refrigerators https://api.projectnimbus.org/neaodataservice.svc/RefrigeratorSet Click Here
Vehicles Dataset of Vehicles https://api.projectnimbus.org/neaodataservice.svc/VehicleSet Click Here

Code Snippet

.NET – How do I access a complete list of Nowcast Conditions for the areas near me

public List<WeatherEntry> GetWeatherFromNimbusNEA(string AccountKey, string UniqueUserID)
    {

        System.Net.WebRequest wr=
          HttpWebRequest.Create(
            "http://api.projectnimbus.org/neaodataservice.svc/NowcastSet?Latitude=1.3&Longitude=103.85&Distance=2000");
        wr.Headers.Add("AccountKey",AccountKey);
        wr.Headers.Add("UniqueUserID",UniqueUserID);
        wr.Method = "GET";
        WebResponse res = wr.GetResponse();
        string resStr
         = new System.IO.StreamReader(res.GetResponseStream()).ReadToEnd();

        XNamespace atomNS
          = "http://www.w3.org/2005/Atom";
        XNamespace dNS
          = "http://schemas.microsoft.com/ado/2007/08/dataservices";
        XNamespace mNS
          = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";

        List<WeatherEntry> results
          = (from item in XElement.Parse(resStr).Descendants(atomNS + "entry")
            let weather = item.Element(atomNS + "content").Element(mNS +"properties")
                select new WeatherEntry() {
                Area = weather.Element(dNS +"Area").Value,
                Condition = weather.Element(dNS +"Condition").Value,
                Lat = weather.Element(dNS + "Latitude").Value,
                Lon = weather.Element(dNS + "Longitude").Value
            }).ToList();

        return results;
    }

Java – How do I access a complete list of Nowcast Conditions for the areas near me

public ArrayList<Weather> getWeather(String accountKey, String uniqueId) {
  weatherList = new ArrayList<Weather>();
  try {
    URL _url = new URL("http://api.projectnimbus.org/neaodataservice.svc/NowcastSet?Latitude=1.3&Longitude=103.85&Distance=2000");
    URLConnection _urlConn = _url.openConnection();
    _urlConn.setRequestProperty("accept", "*/*");
    _urlConn.addRequestProperty("AccountKey", accountKey);
    _urlConn.addRequestProperty("UniqueUserID", uniqueId);
    BufferedReader br = new BufferedReader(new InputStreamReader(_urlConn.getInputStream()));
    String line = null;
    StringBuilder strBuilder = new StringBuilder();
    while ((line = br.readLine()) != null) {
      strBuilder.append(line);
      System.out.println(line);
    }
}

String[] IProperties = strBuilder.toString().split("<m:properties>");
    for (String str : IProperties) {
      Weather weather = new Weather();
      weather.setArea(Utils.getStringBetween(str, "<d:Area>", "</d:Area>"));
      weather.setCondition(Utils.getStringBetween(str, "<d:Condition>", "</d:Condition>"));
      weather.setLatitude(Utils.getStringBetween(str, "<d:Latitude m:type=\"Edm.Double\">", "</d:Latitude>"));
      weather.setLongitude(Utils.getStringBetween(str, "<d:Longitude m:type=\"Edm.Double\">", "</d:Longitude>"));
      weatherList.add(weather);
      }
    } catch (MalformedURLException ex) {
        ex.printStackTrace();
    } catch (IOException ex) {
        ex.printStackTrace();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return weatherList;
}

Helpers Available

.NET – C# Proxy Classes: click here | Read this blog post for more information to use these proxy classes.

JAVA – Read this blog post for more information to use JAVA to connect to the data service.

PHP & AJAX – Read this blog post for more information to use PHP/AJAX to connect to the data service.

obj C / xcode – coming soon

Terms of Use

The datasets:

  • Are here as a community technology preview for a period of time (TBD).
  • Cannot be used in any public offering.
  • Are offered as-is with no official support.

Support

None at this time.

Advertisement
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Datasets – Singapore National Environment Agency (NEA)

  1. Pingback: What is Project Nimbus? How do I get started? « Project Nimbus

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s