Urgent.News

What's breaking now, across thousands of outlets.

Tech

Japan Earthquake API — Free JMA JSON with Magnitude, Intensity and Depth

Japan sits on four tectonic plates, so earthquake data matters — and the authoritative source is the Japan Meteorological Agency (JMA, 気象庁) , not USGS. The JMA publishes a free JSON feed with no API key. The catch is that the hypocentre coordinates are not stored in fields named lat , lon , or depth . This post shows the shape of the data, the one field that trips everyone up, and a free MCP…

The Japan Meteorological Agency (JMA) provides free access to earthquake data through a JSON feed. This feed does not require an API key and returns recent earthquake records, sorted with the newest entries first. Each record contains various details such as hypocentre coordinates and earthquake magnitude.

The hypocentre coordinates are not stored in separate fields like latitude, longitude, or depth. Instead, they are concatenated into a single string, referred to as "cod." The cod string includes latitude, longitude, and depth values, separated by "+" and "-" signs. Understanding the coordinate format is crucial for accurately parsing the data.

To extract the latitude, longitude, and depth from the cod string, a regex pattern is used. The pattern captures three groups of values: latitude, longitude, and depth. The depth value is multiplied by -1 to account for the upward-positive sign convention used by JMA. This conversion is necessary as the depth values represent meters with positive values indicating an upward direction.

Another important aspect to consider is the earthquake intensity. The intensity is represented by a string value and can go beyond a value of 7. JMA uses the "maxi" field to indicate the intensity level, ranging from 1 to 7. However, the scale also includes values like "5-", "5+", "6-", and "6+", which may not be accurately represented as numerical integers. Therefore, it is essential to use an explicit ordering rather than numerical comparison when dealing with intensity values.

Some records may lack intensity information, indicating that these quakes occurred outside Japan's observation network. Additionally, certain earthquake records may not have a magnitude value, and in such cases, it is advisable to treat the absence of magnitude as zero during processing.

To simplify the parsing process, a free MCP (Message Control Protocol) server is available. By making a request to the server with specific parameters, such as minimum magnitude and the desired limit of records, users can receive parsed earthquake data. The MCP server returns a structured response containing metadata, data gaps (if any), and an array of earthquake records with parsed latitude, longitude, depth, magnitude, and intensity values.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The Root KSK Rollover Is Done. Did Your Resolver's Trust Anchor Change?

The root KSK rollover swapped the key at the top of the DNSSEC chain, and what matters now is whether each of your validating resolvers swapped with it.

  • Root KSK rollover completed on October 11, 2024
  • Resolvers must update trust anchors to KSK-2024
  • Failure to update causes SERVFAIL errors for DNS queries

From Design Canvas to React: Build a Shader Hero with InspoAI Shades

The designer wants a background that moves. The developer wants something that won’t eat the page’s performance budget. Both want the headline to stay readable.

  • InspoAI Shades bridges design and code by creating React components from visual effects.
  • Designers work with layers in the editor, adjusting colors and frame size before adding effects.

More from Monday 12 October →