{"id":11171,"date":"2026-04-11T07:26:05","date_gmt":"2026-04-11T07:26:05","guid":{"rendered":"https:\/\/nandedlive.com\/?p=11171"},"modified":"2026-04-11T07:29:04","modified_gmt":"2026-04-11T07:29:04","slug":"11171","status":"publish","type":"post","link":"https:\/\/nandedlive.com\/?p=11171","title":{"rendered":"Nearby Earthquakes"},"content":{"rendered":"<p>&nbsp;<\/p>\n<style>\n        body {<br \/>\n            font-family: Arial;<br \/>\n            background: #0f172a;<br \/>\n            color: white;<br \/>\n            text-align: center;<br \/>\n        }<br \/>\n        h1 {<br \/>\n            color: #38bdf8;<br \/>\n        }<br \/>\n        .quake {<br \/>\n            background: #1e293b;<br \/>\n            margin: 10px;<br \/>\n            padding: 15px;<br \/>\n            border-radius: 10px;<br \/>\n        }<br \/>\n        button {<br \/>\n            padding: 10px 20px;<br \/>\n            background: #38bdf8;<br \/>\n            border: none;<br \/>\n            border-radius: 5px;<br \/>\n            cursor: pointer;<br \/>\n        }<br \/>\n    <\/style>\n<p>&nbsp;<\/p>\n<h1>\ud83c\udf0d Nearby Earthquakes<\/h1>\n<p><button>Check Nearby Earthquakes<\/button><\/p>\n<div id=\"results\"><\/div>\n<p><script>\nfunction getLocation() {\n    if (navigator.geolocation) {\n        navigator.geolocation.getCurrentPosition(fetchEarthquakes);\n    } else {\n        alert(\"Geolocation not supported\");\n    }\n}\nfunction fetchEarthquakes(position) {\n    let lat = position.coords.latitude;\n    let lon = position.coords.longitude;\n    fetch(\"https:\/\/earthquake.usgs.gov\/earthquakes\/feed\/v1.0\/summary\/all_day.geojson\")\n    .then(res => res.json())\n    .then(data => {\n        let earthquakes = data.features;\n        let output = \"\";\n        earthquakes.forEach(eq => {\n            let coords = eq.geometry.coordinates;\n            let eqLon = coords[0];\n            let eqLat = coords[1];\n            let distance = getDistance(lat, lon, eqLat, eqLon);\n            if (distance <= 500) { \/\/ 500 km radius\n                output += `\n                    \n<div class=\"quake\">\n<h3>${eq.properties.place}<\/h3>\n\nMagnitude: ${eq.properties.mag}\n\nDistance: ${distance.toFixed(2)} km\n\nTime: ${new Date(eq.properties.time)}\n<\/div>\n\n                `;\n            }\n        });\n        document.getElementById(\"results\").innerHTML =\n            output || \"\nNo nearby earthquakes found.\n\";\n    });\n}\n\/\/ Haversine formula to calculate distance\nfunction getDistance(lat1, lon1, lat2, lon2) {\n    const R = 6371;\n    let dLat = (lat2 - lat1) * Math.PI \/ 180;\n    let dLon = (lon2 - lon1) * Math.PI \/ 180;\n    let a =\n        Math.sin(dLat\/2) * Math.sin(dLat\/2) +\n        Math.cos(lat1 * Math.PI\/180) *\n        Math.cos(lat2 * Math.PI\/180) *\n        Math.sin(dLon\/2) * Math.sin(dLon\/2);\n    let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n    return R * c;\n}\n<\/script><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; &nbsp; &eth;&#159;&#140;&#141; Nearby Earthquakes Check Nearby Earthquakes &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_elementor_edit_mode":"","_elementor_template_type":"","_elementor_data":"","_elementor_page_settings":null},"categories":[1],"tags":[],"class_list":["post-11171","post","type-post","status-publish","format-standard","hentry","category-1"],"featured_image_urls":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":"","covernews-featured":"","covernews-medium":""},"author_info":{"info":["admin"]},"category_info":"<a href=\"https:\/\/nandedlive.com\/?cat=1\" rel=\"category\">\u092e\u0939\u0924\u094d\u0935\u093e\u091a\u094d\u092f\u093e \u092c\u093e\u0924\u092e\u094d\u092f\u093e<\/a>","tag_info":"\u092e\u0939\u0924\u094d\u0935\u093e\u091a\u094d\u092f\u093e \u092c\u093e\u0924\u092e\u094d\u092f\u093e","comment_count":"0","_links":{"self":[{"href":"https:\/\/nandedlive.com\/index.php?rest_route=\/wp\/v2\/posts\/11171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nandedlive.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nandedlive.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nandedlive.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nandedlive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11171"}],"version-history":[{"count":5,"href":"https:\/\/nandedlive.com\/index.php?rest_route=\/wp\/v2\/posts\/11171\/revisions"}],"predecessor-version":[{"id":11176,"href":"https:\/\/nandedlive.com\/index.php?rest_route=\/wp\/v2\/posts\/11171\/revisions\/11176"}],"wp:attachment":[{"href":"https:\/\/nandedlive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nandedlive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nandedlive.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}