Author Topic: New quake-json.php script replaces quake-USA/quake-WORLD scripts  (Read 17199 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #25 on: September 10, 2012, 12:10:45 PM »
Thanks once again for a great script Ken!!

I'm trying to figure out what to make wider to get my world page to fit.
I've made the page 800px but this one runs off the page while the others look great!

http://www.cnyweather.com/wxquake_world.php
Hi Tony,

This is a classic case of trying to stuff 10lbs in a 5lb bag .. that is, the code for the table with the details has specifically disallowed 'folding' for the location and time display cells, and with the default font size, the only thing the browser can do is expand the table beyond the 620px normal bounds to have it display.  The simple way to fix it is to reduce the font size by changing the CSS to
Code: [Select]
.quake {
  width: 620px;
  font-size: 10px;
}
, then it all fits.

However.. you should consider changing the minimum magnitude to 4.0 for the World display .. the USGS doesn't collect data for less than 4.0 from worldwide locations (the 1.0-4.0 magnitude quake data is for the USA and territories only).  The current 1.5 magnitude filter (and legend) gives the wrong impression about the data displayed, and folks might wonder why the 1.5-4.0 quakes in the non-USA parts of the world are not displayed (because the USGS doesn't offer up that data).

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #26 on: September 10, 2012, 12:19:25 PM »
Hi
Pretty new to this stuff.
Had tried the Cumulus standard website but thought your website would be better!
Website looks good and all working pretty well then I discovered the update to the quake page, and the updates checking etc.

Original download was on 7/sep/2012 with the newest file dated 1/sep/2012 (going by file date in Base-World.zip).

So ran the check and built the updates file set using 1/sep/2012. Installed the updated files after editing the files as specified.

However, the quake page is not displaying properly (www.silveracorn.co.nz/weather/wxquake.php).

Apart from the map issue, the quake magnitude and distance settings shown on the page do not agree with the settings in quake-json.php -
$minRichter = '2.0';   // minimum Richter scale earthquake to display
  $maxDistance = 1000;    // quake must be within this number of miles/kilometers to location ....
  $highRichter = "5.0"; //change color for quakes >= this magnitude
  $refetchSeconds = 1800;     // refetch every nnnn seconds 1800secs = 30mins

OK, found the settings in a second place so this part is fixed.

Any assistance would be much appreciated.

Thanx

Hi,
There was an update to the quake-json.php script on 9-Sep-2012 to fix two issues:
1) the ' GMT' showing in the local time display with some settings for $timeFormat
2) a better method to include the table column sorting data that is XHTML 1.0-Strict compliant

I would suggest you change your minimum magnitude filter to 4.0 as the USGS only includes 4.0+ magnitude quake data for non-USA locations, and at the current settings for your page, it may give the impression that there were no <4.0 quakes (which there may have been, but just not included in the USGS feed).

Glad you got the settings stuff sorted out :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2297
    • CNYWeather
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #27 on: September 10, 2012, 12:41:09 PM »
Thanks once again for a great script Ken!!

I'm trying to figure out what to make wider to get my world page to fit.
I've made the page 800px but this one runs off the page while the others look great!

http://www.cnyweather.com/wxquake_world.php
Hi Tony,

This is a classic case of trying to stuff 10lbs in a 5lb bag .. that is, the code for the table with the details has specifically disallowed 'folding' for the location and time display cells, and with the default font size, the only thing the browser can do is expand the table beyond the 620px normal bounds to have it display.  The simple way to fix it is to reduce the font size by changing the CSS to
Code: [Select]
.quake {
  width: 620px;
  font-size: 10px;
}
, then it all fits.

However.. you should consider changing the minimum magnitude to 4.0 for the World display .. the USGS doesn't collect data for less than 4.0 from worldwide locations (the 1.0-4.0 magnitude quake data is for the USA and territories only).  The current 1.5 magnitude filter (and legend) gives the wrong impression about the data displayed, and folks might wonder why the 1.5-4.0 quakes in the non-USA parts of the world are not displayed (because the USGS doesn't offer up that data).

Best regards,
Ken

I saw someone else had made a USA and World one and fiddled quickly before work today.
I did make your suggested changes Ken, and looks great now.

THANK YOU!  :grin:
Tony




Offline BCJKiwi

  • Forecaster
  • *****
  • Posts: 302
    • Silver Acorn Weather - N.Z.
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #28 on: September 10, 2012, 05:40:21 PM »
Hi
Pretty new to this stuff.
Had tried the Cumulus standard website but thought your website would be better!
Website looks good and all working pretty well then I discovered the update to the quake page, and the updates checking etc.

Original download was on 7/sep/2012 with the newest file dated 1/sep/2012 (going by file date in Base-World.zip).

So ran the check and built the updates file set using 1/sep/2012. Installed the updated files after editing the files as specified.

However, the quake page is not displaying properly (www.silveracorn.co.nz/weather/wxquake.php).

Apart from the map issue, the quake magnitude and distance settings shown on the page do not agree with the settings in quake-json.php -
$minRichter = '2.0';   // minimum Richter scale earthquake to display
  $maxDistance = 1000;    // quake must be within this number of miles/kilometers to location ....
  $highRichter = "5.0"; //change color for quakes >= this magnitude
  $refetchSeconds = 1800;     // refetch every nnnn seconds 1800secs = 30mins

OK, found the settings in a second place so this part is fixed.

Any assistance would be much appreciated.

Thanx

Hi,
There was an update to the quake-json.php script on 9-Sep-2012 to fix two issues:
1) the ' GMT' showing in the local time display with some settings for $timeFormat
2) a better method to include the table column sorting data that is XHTML 1.0-Strict compliant

I would suggest you change your minimum magnitude filter to 4.0 as the USGS only includes 4.0+ magnitude quake data for non-USA locations, and at the current settings for your page, it may give the impression that there were no <4.0 quakes (which there may have been, but just not included in the USGS feed).

Glad you got the settings stuff sorted out :)

Best regards,
Ken

Well I downloaded the updates on the 10th (NZ Time) and they already included the updated 9/9/2012 version 1.01.
Have changed the min to 4 as suggested - no change to the site
The settings changes need to be done in two places;
the $setdistanceradius = and $setmagnitude = are coming from wxquake.php and the $minRichter $maxDistance are coming from quake-json.php - a bit confusing for a newbie!

The remaining issue is that I just don't get the google map - just a frame for it - no title above either.
Also, clicking on the sort arrowed column titles does not do anything (mouse cursor changes to double headed vertical arrow but no action when clicked.
Everything else on the page seems to be OK

Thanx

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #29 on: September 10, 2012, 05:42:52 PM »
Hey Ken

I updated to the new release last night and all was fine.  This afternoon however I get this:

Quote
Warning: Invalid argument supplied for foreach() in /home/content/22/3672722/html/quake-json.php on line 443
 
No earthquakes of magnitude 2.0 or greater within 500 mi reported in last 7 days.

Could this be related to the Godaddy issues since GD is my host?  Or is it a different annimal all togather?


Dave
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #30 on: September 10, 2012, 05:51:27 PM »
I think the issue was a missed cache fill
Quote
<!-- quake-json.php V1.01 - 09-Sep-2012 -->
<!-- lat=41.3336 long=-87.7891 dist=500 mag=2.0 distanceDisplay ='mi' -->
<!-- using Cached version of ./quakesjson.txt -->
<!-- cache data saved Mon, 10-Sep-2012 21:36:38 GMT UTC -->
<!-- Update time = Mon, 10-Sep-2012 21:36:38 GMT UTC-->
<!-- Update time = Mon, 10-Sep-2012 16:36:38 CDT  Local-->
<!-- content length=0 -->
<!-- found 0 earthquake records -->
<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/content/22/3672722/html/quake-json.php</b> on line <b>443</b><br />

I ran your page ( quake-json.php?cache=no ) and got the cache refilled, so it's working now.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #31 on: September 10, 2012, 06:07:02 PM »

Well I downloaded the updates on the 10th (NZ Time) and they already included the updated 9/9/2012 version 1.01.
Have changed the min to 4 as suggested - no change to the site
The settings changes need to be done in two places;
the $setdistanceradius = and $setmagnitude = are coming from wxquake.php and the $minRichter $maxDistance are coming from quake-json.php - a bit confusing for a newbie!

The remaining issue is that I just don't get the google map - just a frame for it - no title above either.
Also, clicking on the sort arrowed column titles does not do anything (mouse cursor changes to double headed vertical arrow but no action when clicked.
Everything else on the page seems to be OK

Thanx
The issue is that the quake-json.js script is not on your site at http://www.silveracorn.co.nz/weather/quake-json.js

Upload that script, and the map should show :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Silversword

  • --Stan Y.
  • Forecaster
  • *****
  • Posts: 560
    • Up Country Maui Weather
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #32 on: September 10, 2012, 06:20:45 PM »
Hi Ken,

It looks like I really need to update to V3 as I get an error using the updated quake-json files...  Hope that is the case that I need to work on.

Looks like it is a tremendous improvement over the previous quake scripts.

Thanks for the updates.

--Stan Y.
   Maui, Hawaii
Stan Y. - KH6HHG - Maui, Hawaii
 --- Blitzortung ID: 993
 --- FlightRadar24 ID: F-PHOG1

WDL 6.05
MS Windows 7 Pro
Dell Optiplex GX280-Intel Pentium 4 CPU 3.00GHz, 4 GB RAM
Davis Vantage Pro 2+ Wireless
Webcam: Axis 211

Offline BCJKiwi

  • Forecaster
  • *****
  • Posts: 302
    • Silver Acorn Weather - N.Z.
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #33 on: September 10, 2012, 06:41:52 PM »

Well I downloaded the updates on the 10th (NZ Time) and they already included the updated 9/9/2012 version 1.01.
Have changed the min to 4 as suggested - no change to the site
The settings changes need to be done in two places;
the $setdistanceradius = and $setmagnitude = are coming from wxquake.php and the $minRichter $maxDistance are coming from quake-json.php - a bit confusing for a newbie!

The remaining issue is that I just don't get the google map - just a frame for it - no title above either.
Also, clicking on the sort arrowed column titles does not do anything (mouse cursor changes to double headed vertical arrow but no action when clicked.
Everything else on the page seems to be OK

Thanx
The issue is that the quake-json.js script is not on your site at http://www.silveracorn.co.nz/weather/quake-json.js

Upload that script, and the map should show :)

Best regards,
Ken

Thanks very much,

I just don't know how I missed that - I thought I was being so careful - Duhh!

Really appreciate your time and effort on this and your very prompt response.


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #34 on: September 10, 2012, 07:56:24 PM »
You're quite welcome.  Enjoy!

BTW... I added your site to the list of sites also  :grin:

Best regards,
Ken
« Last Edit: September 10, 2012, 08:01:15 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #35 on: September 10, 2012, 08:17:45 PM »
Hi Ken,

It looks like I really need to update to V3 as I get an error using the updated quake-json files...  Hope that is the case that I need to work on.

Looks like it is a tremendous improvement over the previous quake scripts.

Thanks for the updates.

--Stan Y.
   Maui, Hawaii

Hi Stan,

I see that http://www.dwayneyamato.com/wx/quake-json.php is working for you.  Was it the updated wxquake.php that was the problem?  Your current version is the old one.  Try using the new version (name it wxquake2.php), and customize the internal settings there .. it should work even with a V2 template (but it may need the extra 'shim' code to make up for not having the langtrans/langtransstr functions available).
If that's the case, the change the new wxquake2.php from
Code: [Select]
require_once("common.php");
############################################################################
to
Code: [Select]
require_once("common.php");
# Shim function if run outside of AJAX/PHP template set
# these must be before the missing function is called in the source
if(!function_exists('langtransstr')) {
function langtransstr($item) {
return($item);
}
}
if(!function_exists('langtrans')) {
function langtrans($item) {
echo $item;
return;
}
}
############################################################################
and the page should load properly.

Best regards,
Ken

BTW... do keep trying the V3 conversion.. it will save you a lot of time and effort to keep your site updated :)
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #36 on: September 10, 2012, 08:49:50 PM »
Thanks Ken!

Dave
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline user3162

  • Member
  • *
  • Posts: 40
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #37 on: September 10, 2012, 09:23:00 PM »
I'm not getting the Google map, either, but quake-json.js script is on my site.
http://www.nhpaweather.com/wxquake.php

Offline Silversword

  • --Stan Y.
  • Forecaster
  • *****
  • Posts: 560
    • Up Country Maui Weather
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #38 on: September 11, 2012, 01:18:33 AM »
Hi Ken,

As usual, you found a solution to my issue.  Yes, using the updated wxquake.php was the issue and adding the the lines you provided solved it.  Guess in the common.php has the langtrans/langtransstr functions that I don't have there yet with V3 templates. Using the wxquake2.php working but will take the 2 off so it will work with the menu bar.

Thanks again for all and will hammer away with the conversion to V3.

Best Regards and Aloha,

--Stan Y.
  Maui, Hawaii
 
Stan Y. - KH6HHG - Maui, Hawaii
 --- Blitzortung ID: 993
 --- FlightRadar24 ID: F-PHOG1

WDL 6.05
MS Windows 7 Pro
Dell Optiplex GX280-Intel Pentium 4 CPU 3.00GHz, 4 GB RAM
Davis Vantage Pro 2+ Wireless
Webcam: Axis 211

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #39 on: September 11, 2012, 02:30:28 AM »
I'm not getting the Google map, either, but quake-json.js script is on my site.
http://www.nhpaweather.com/wxquake.php
You seem to be getting a JavaScript error at the generated line in quake-json.php (line 484) which reads:

   var center = new google.maps.LatLng(40.093856,-076.089719);

Try changing your Settings.php
Code: [Select]
$SITE['longitude']        = '-076.089719';  //East=positive, West=negative decimal degrees
to
Code: [Select]
$SITE['longitude']        = '-76.089719';  //East=positive, West=negative decimal degrees
and see if that fixes it.  It might be the leading zero in the longitude that's confusing the GoogleMap API.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline user3162

  • Member
  • *
  • Posts: 40
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #40 on: September 11, 2012, 07:26:52 AM »

You seem to be getting a JavaScript error at the generated line in quake-json.php (line 484) which reads:

   var center = new google.maps.LatLng(40.093856,-076.089719);

Try changing your Settings.php
Code: [Select]
$SITE['longitude']        = '-076.089719';  //East=positive, West=negative decimal degrees
to
Code: [Select]
$SITE['longitude']        = '-76.089719';  //East=positive, West=negative decimal degrees
and see if that fixes it.  It might be the leading zero in the longitude that's confusing the GoogleMap API.

Best regards,
Ken

Thanks Ken, that did it!

Offline DaculaWeather

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 3206
    • North Georgia Weather
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #41 on: September 11, 2012, 11:48:22 AM »
Hey Ken!
As you know, I don't use your templates so I always have extra issues! :-)

I'm getting this:

Warning: Invalid argument supplied for foreach() in /hsphere/local/home/bruecksteve/daculaweather.com/quake-json.php on line 443

Any idea?

Offline DaculaWeather

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 3206
    • North Georgia Weather
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #42 on: September 11, 2012, 12:00:37 PM »
never mind... fixed!  :grin:

Offline katlon

  • LONNIE'S WEATHER STATION
  • Contributor
  • ***
  • Posts: 142
  • GO HEELS!!!
    • LONNIE'S WEATHER STATION
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #43 on: September 11, 2012, 06:34:37 PM »
Thanks Ken. Great work as always.
http://pulliamjr.com/quake/quake-json.php

Lonnie

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #44 on: September 11, 2012, 09:51:15 PM »
Works fine here - http://tiggrweather.net/wxquake.php

Thanks, Ken!
John
W7JKG

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2297
    • CNYWeather
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #45 on: September 12, 2012, 12:01:51 PM »
Slow day at work, so I'm trying to do an Alaska Earthquake Page

Here's the quake-alaska-json.php I made:

Code: [Select]
//  set to station latitude/longitude (decimal degrees)
  $myLat = 61.21574783;   //North=positive, South=negative decimal degrees
    $myLong = -149.86894226;    //East=positive, West=negative decimal degrees
   
// The above settings are for saratoga-weather.org location
//
 $ourTZ = "America/Anchorage";  //NOTE: this *MUST* be set correctly to
// translate UTC times to your LOCAL time for the displays.
// Use http://www.php.net/manual/en/timezones.php to find the timezone suitable for
//  your location.
//
//  pick a format for the time to display ..uncomment one (or make your own)
//$timeFormat = 'D, Y-m-d H:i:s T';  // Fri, 2006-03-31 14:03:22 TZone
  $timeFormat = 'D, d-M-Y H:i:s T';  // Fri, 31-Mar-2006 14:03:22 TZone
 
// setting for how to display distances .. uncomment one below
// note: will be overridden by $SITE['distanceDisplay']  or $setDistanceDisplay if it exists
//
  $distanceDisplay = 'mi (km)';   // display for distances in 'N mi (K km)'
//  $distanceDisplay = 'mi';   // display for distances in 'N mi'
//  $distanceDisplay = 'km (mi)';   // display for distances in 'K km (N mi)'
//  $distanceDisplay = 'km';   // display for distances in 'K km'

  $minRichter = '4.0';   // minimum Richter scale earthquake to display
  $maxDistance = 500;    // quake must be within this number of miles/kilometers to location
                         // specified in $myLat, $myLong latitude/longitude
// and miles/kilometers chosen by first entry in $distanceDisplay above
 
  $highRichter = "5.0"; //change color for quakes >= this magnitude
  $mapZoomDefault = 8;  // default Google Map zoom entry for display (1=world, 13=street)


  $cacheFileDir = './';   // default cache file directory
  $cacheName = "quakesalaskajson.txt";  // used to store the file so we don't have to
  //                          fetch it each time
  $refetchSeconds = 10;     // refetch every nnnn seconds

  $imagesDir = './ajax-images/';
  $doLinkTarget = true; // =true to add target="_blank" to links in popups

I gave it it's own $cacheName which has data: http://www.cnyweather.com/cache/quakesalaskajson.txt

But the page shows the same as my local quake page with my local map.
http://www.cnyweather.com/wxquake_alaska.php

Tony
Tony




Offline William Grimsley

  • Forecaster
  • *****
  • Posts: 1103
    • Newton Poppleford Weather
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #46 on: September 12, 2012, 12:06:28 PM »
Hi CNYWeather,

This is strange...I can't see anything wrong with your .php script and your coordinates are correct. Don't know when Ken will be online but hopefully soon. Give him a bell he should be able to help! :)

Will
http://www.newton-poppleford-weather.co.uk
Davis Vantage Vue - Cumulus v1.9.4 (1084)
Weather Underground: IDEVONEX12
Met Office WOW: 717144
PWS Weather: ENG128597

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2297
    • CNYWeather
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #47 on: September 12, 2012, 12:27:09 PM »
Yep, that's what has me scratching my head. It looks ok  :lol:

Thanks!
Tony




Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #48 on: September 12, 2012, 01:07:25 PM »
Latest update to the quake-json.php (V1.02) and for template users, wxquake.php adds these features:
1) a new $setDoLinkTarget parameter before the include("quake-json.php") that controls opening the links in a new page in both the table and the popup windows
2) support for translation of Google Map controls (when run with the AJAX/PHP template set)
3) improved diagnostics for getting the GeoJSON feed from the USGS
4) a ?cache=no argument to force a cache refresh

Standalone script users: http://saratoga-weather.org/scripts-quake.php for the download

V3 template users: http://saratoga-weather.org/wxtemplates/updates.php for 12-Sep-2012 query
The Base-World update includes the Danish, Dutch, Greek, Italian, and Norwegian translation updates to support the
wxquake.php display.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: New quake-json.php script replaces quake-USA/quake-WORLD scripts
« Reply #49 on: September 12, 2012, 01:19:32 PM »
Slow day at work, so I'm trying to do an Alaska Earthquake Page

Here's the quake-alaska-json.php I made:

Code: [Select]
//  set to station latitude/longitude (decimal degrees)
  $myLat = 61.21574783;   //North=positive, South=negative decimal degrees
    $myLong = -149.86894226;    //East=positive, West=negative decimal degrees
   
// The above settings are for saratoga-weather.org location
//
 $ourTZ = "America/Anchorage";  //NOTE: this *MUST* be set correctly to
// translate UTC times to your LOCAL time for the displays.
// Use http://www.php.net/manual/en/timezones.php to find the timezone suitable for
//  your location.
//
//  pick a format for the time to display ..uncomment one (or make your own)
//$timeFormat = 'D, Y-m-d H:i:s T';  // Fri, 2006-03-31 14:03:22 TZone
  $timeFormat = 'D, d-M-Y H:i:s T';  // Fri, 31-Mar-2006 14:03:22 TZone
 
// setting for how to display distances .. uncomment one below
// note: will be overridden by $SITE['distanceDisplay']  or $setDistanceDisplay if it exists
//
  $distanceDisplay = 'mi (km)';   // display for distances in 'N mi (K km)'
//  $distanceDisplay = 'mi';   // display for distances in 'N mi'
//  $distanceDisplay = 'km (mi)';   // display for distances in 'K km (N mi)'
//  $distanceDisplay = 'km';   // display for distances in 'K km'

  $minRichter = '4.0';   // minimum Richter scale earthquake to display
  $maxDistance = 500;    // quake must be within this number of miles/kilometers to location
                         // specified in $myLat, $myLong latitude/longitude
// and miles/kilometers chosen by first entry in $distanceDisplay above
 
  $highRichter = "5.0"; //change color for quakes >= this magnitude
  $mapZoomDefault = 8;  // default Google Map zoom entry for display (1=world, 13=street)


  $cacheFileDir = './';   // default cache file directory
  $cacheName = "quakesalaskajson.txt";  // used to store the file so we don't have to
  //                          fetch it each time
  $refetchSeconds = 10;     // refetch every nnnn seconds

  $imagesDir = './ajax-images/';
  $doLinkTarget = true; // =true to add target="_blank" to links in popups

I gave it it's own $cacheName which has data: http://www.cnyweather.com/cache/quakesalaskajson.txt

But the page shows the same as my local quake page with my local map.
http://www.cnyweather.com/wxquake_alaska.php

Tony

Hi Tony,

While you've modified the internal settings for Alaska to
Code: [Select]
  $myLat = 61.21574783;   //North=positive, South=negative decimal degrees
    $myLong = -149.86894226;    //East=positive, West=negative decimal degrees
   
// The above settings are for saratoga-weather.org location
//
 $ourTZ = "America/Anchorage";  //NOTE: this *MUST* be set correctly to
you need to remember that your own Settings.php values will override those unless you change the quake-alaska-json.php script to comment out these lines
Code: [Select]
if (isset($SITE['latitude'])) {$myLat = $SITE['latitude'];}
if (isset($SITE['longitude'])) {$myLong = $SITE['longitude'];}
if (isset($SITE['tz'])) {$ourTZ = $SITE['tz']; }

The quake-json script (and all the support scripts) will try to use your Settings.php values to auto-configure so you can normally just replace the script without modification and have it work.  When you repurpose the scripts, just remember to comment-out the overrides from Settings.php in the copies so you'll get the results you want :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

 

anything