Author Topic: Earthquake Map Not Showing  (Read 315 times)

0 Members and 1 Guest are viewing this topic.

Offline southcoastwx

  • Member
  • *
  • Posts: 4
    • Gary's Southcoast Weather Page
Earthquake Map Not Showing
« on: April 11, 2018, 07:19:13 PM »
My earthquake map is not displaying....I've added the Google API as suggested in an earlier topic. Any ideas what else to look for?

 [ You are not allowed to view attachments ]

Offline Jasiu

  • Senior Contributor
  • ****
  • Posts: 297
    • LexMAWeather
Re: Earthquake Map Not Showing
« Reply #1 on: April 11, 2018, 08:32:32 PM »
Link to your site?

The first thing I look for these days is an https requirement when the script uses http.

Offline southcoastwx

  • Member
  • *
  • Posts: 4
    • Gary's Southcoast Weather Page
Re: Earthquake Map Not Showing
« Reply #2 on: April 11, 2018, 08:40:06 PM »
Southcoastwx.net

Still a work in progress.

Offline southcoastwx

  • Member
  • *
  • Posts: 4
    • Gary's Southcoast Weather Page
Re: Earthquake Map Not Showing
« Reply #3 on: April 11, 2018, 08:51:20 PM »
  I thought about that, but I figured a regional map would show anyway.  Can I edit my site to change criteria?

Thanks, Gary

Offline ALITTLEweird1

  • Mark
  • Global Moderator
  • Forecaster
  • *****
  • Posts: 814
    • North Bend Weather
Re: Earthquake Map Not Showing
« Reply #4 on: April 11, 2018, 08:57:39 PM »
There are setting you change within the script, range from epicenter and magnitude. If I remember right, the default settings are 200 miles and 2.0
"Nature can do without man, but man cannot do without nature."


Software: WeatherDisplay
Hardware: Davis VP2 + VP2 Solar + VP2 UV + Lightning Detector + Logitech Webcam

Offline Jasiu

  • Senior Contributor
  • ****
  • Posts: 297
    • LexMAWeather
Re: Earthquake Map Not Showing
« Reply #5 on: April 11, 2018, 09:02:59 PM »
The javascript to create the map is looking for an HTML tag with the id of "map":

Code: [Select]
var map = new google.maps.Map(document.getElementById("map"), options);
... which isn't there (or I missed it).

It should just be a matter of adding a div with the id "map" where you want the map to appear:
Code: [Select]
<div id="map"></div>

Offline Jasiu

  • Senior Contributor
  • ****
  • Posts: 297
    • LexMAWeather
Re: Earthquake Map Not Showing
« Reply #6 on: April 11, 2018, 09:44:24 PM »
Just took a look at the source (I don't use it so I'm not familiar with it). So it seems that the code doesn't produce a map if there are no quakes to show.

This is the bit of code that provides the map div:

Code: [Select]
      <div id="map-container">
        <div id="map"></div>
      </div>

but that gets inserted within the foreach loop which only executes if quakes are found.

If you want the map unconditionally, or just want to see what it looks like temporarily, you can add a bit of code later on where the "No earthquakes" message appears (and then remove it again if it is temporary).

Code: [Select]
} else {
          // --------------- customize HTML if you like -----------------------
          print "<div id=\"map-container\"><div id=\"map\"></div></div>"; // ADDED CODE.....
          if(strlen($content) > 10) {
      print "<p>".langtransstr("No earthquakes of magnitude")." $minRichter ".langtransstr("or greater within")." $dmaxDist ".langtransstr("reported in last 7 days").".</p>\n";
  } else {
    print "<h3>".langtransstr('The USGS feed for earthquakes was not available at this time.')."</h3>\n";
  }
 
}

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6745
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Earthquake Map Not Showing
« Reply #7 on: April 11, 2018, 11:23:31 PM »
The script is operating properly on your site.  With the default 200 mile distance from your lat/long, there are no earthquakes in that radius, so no map is displayed.

If you use http://southcoastwx.net/wxquake.php?distance=2000 for a 2000 mile radius, you'll see a map, and the nearest earthquake to you is
19 mi SSW of Wellsboro, Pennsylvania    2.6    333 mi    Thu, 05-Apr-2018 6:19pm EDT

You can adjust the distance filter and the map scaling in the wxquake.php page
Code: [Select]
  $setDistanceRadius  = 200;  // same units as first unit in $setDistanceDisplay
# NOTE: quakes of magnitude 1.0+ are available for USA locations only.
#    non-USA location earthquakes of magnitude 4.0+ are the only ones available from the USGS
  $setMinMagnitude = '2.0';  // minimum Richter Magnitude to display
  $setHighMagnitude = '4.0';  // highlight this Magnitude and greater
 
  $setMapZoomDefault = 7;    // default zoom for Google Map 1=world to 13=street

I'd suggest you use
Code: [Select]
  $setDistanceRadius  = 1500;  // same units as first unit in $setDistanceDisplay
# NOTE: quakes of magnitude 1.0+ are available for USA locations only.
#    non-USA location earthquakes of magnitude 4.0+ are the only ones available from the USGS
  $setMinMagnitude = '2.0';  // minimum Richter Magnitude to display
  $setHighMagnitude = '4.0';  // highlight this Magnitude and greater
 
  $setMapZoomDefault = 5;    // default zoom for Google Map 1=world to 13=street
and it will show quakes on your map.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline southcoastwx

  • Member
  • *
  • Posts: 4
    • Gary's Southcoast Weather Page
Re: Earthquake Map Not Showing
« Reply #8 on: April 12, 2018, 03:48:23 AM »
Editing the script to adjust the radius did the trick...thanks so much!

Cheers, Gary

 

anything