Author Topic: Google API billing  (Read 3013 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Google API billing
« Reply #25 on: May 10, 2018, 11:36:34 PM »
Ok, that is strange.  Your quake-json.php does have
Code: [Select]
if (isset($setMapProvider))     { $mapProvider = $setMapProvider; }
so it should honor the selection
Code: [Select]
$setMapProvider = 'OSM';     // OpenStreetMap - no key needed in quakes.php

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 Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 321
    • Indian Trail Weather
Re: Google API billing
« Reply #26 on: May 11, 2018, 10:59:42 PM »
Nice job Ken ...  \:D/  Great looking script and no Google API :!:

Thank you.  =D>
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline zeppline

  • Senior Member
  • **
  • Posts: 66
    • Las Vegas Weather Guy
Re: Google API billing
« Reply #27 on: May 13, 2018, 09:05:28 PM »
I downloaded the new earthquake script but I have no maps. Do I have to download something else? Using template.
http://lasvegaswx.com/wxquake.php Thanks Joe

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Google API billing
« Reply #28 on: May 13, 2018, 11:25:33 PM »
The map looks fine to me.. You are missing the leaflet.png and leaflet-2x.png files in ajax-images/ directory, but other than that.. it seems to be working.
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 zeppline

  • Senior Member
  • **
  • Posts: 66
    • Las Vegas Weather Guy
Re: Google API billing
« Reply #29 on: May 14, 2018, 12:17:05 PM »
Thanks loaded to wrong directory. Should it be leaflet.png or layers.png? I loaded layers.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Google API billing
« Reply #30 on: May 14, 2018, 12:18:42 PM »
My bad.. should be layers.png and layers-2x.png
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 zeppline

  • Senior Member
  • **
  • Posts: 66
    • Las Vegas Weather Guy
Re: Google API billing
« Reply #31 on: May 14, 2018, 02:42:32 PM »
Thanks. Joe

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: Google API billing
« Reply #32 on: May 23, 2018, 05:40:10 PM »
Ok, Version 3.00 - 10-May-2018 of the quake-json scripts has been released.

Ken,
thanks for the nice work.

Works like a charm
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Google API billing
« Reply #33 on: August 12, 2018, 07:57:47 PM »
I just posted V4.00 of the global-map script set converted to use Leaflet/OpenStreetMaps -- no API key required :)

Download from the script page

If you had the V2.x version on your site, after you do the configuration/upload, be sure to shift-reload in your browser to clear the cache of the old CSS/JavaScript.  Also note that if you embedded it in your page previously, the method to invoke the script has changed a bit.. see global-map.php (or wxglobal.php) for the example methods.   Also, only the English and Spanish wxglobal-LL.html files were included at this time.. I don't have other examples ready.

Here's the global-map-README.txt
Code: [Select]
This is Version 4.00 of the Regional Affiliated Networks Global map.

This 4.xx version provides for Saratoga template or standalone usage (unlike previous
versions with came in separate template/standalone versions)

This version requires no API keys to operate as it uses Leaflet/OpenStreetMaps
for map tile services instead of the prior Google JavaScript Map API.
Support is also provided for optional Mapbox.com map tiles if you have
acquired a Mapbox Access Token (API key). Two additional maps will be enabled
(Terrain3 and Satellite) with a valid Mapbox Access Token.

Files in the distribution:

global-map-README.txt   (this file)

./MESO-images/*         Image files used by the map display

global-map-settings.php (this file contains ALL the configuration settings for the script set)

global-map.php          (this is a single-page, non-template PHP sample page)


global-map.css          (style sheet for all the above pages)
global-map.js           (common JavaScript routines used by all the global map pages)

global-map-inc.php      (generation script used by wxglobal.php or global-map-sample.php pages)

global-map-lang-inc.php (PHP serialize[d] array of language entries for legend text.
                         NOTE: do NOT edit or modify in any way or the script will break)

global-map-genjs-inc.php (generates the JavaScript to control the Leaflet map)

global-conditions-json.php (common script for getting conditions data from the network hub site)\
  it will update the following file (so make sure permissions on it are 664 if need be):
     global-conditions.json

global-links.php        (script for getting data/links about the regional networks -
  it will update the following files (so make sure permissions on them are 664 if need be):
     member-count.txt
     members-list-inc.html
     network-links-inc.html
     network-list-inc.html

These scripts are used by the wxglobal.php (Saratoga Template):
wxglobal.php            (global map page for V2 or V3 of Saratoga template set)
wxglobal-en.html        (English boilerplate page for V2 or V3 of Saratoga template set)
wxglobal-es.html        (Spanish boilerplate page for V2 or V3 of Saratoga template set)

Configuration for the wxglobal.php or global-map.php pages is in global-map-settings.php
and looks like this:

// ------------- Required settings for global-map.* scripts ----------------------------------------
//
  $lang = 'en';      // default language
  $condIconsDir = './MESO-images/';  // relative directory for pin/cluster/conditions images
  $netLinksPath = './';  // relative path for including the network links files from get-links.php
  //   units-of-measure defaults for display
  $gmTempUOM = 'F';   // units for Temperature ='C' or ='F';
  $gmWindUOM = 'mph'; // units for Wind Speed ='mph', ='km/h', ='m/s', ='kts'
  $gmBaroUOM = 'inHg';// units for Barometer ='inHg', ='hPa', ='mb'
  $gmRainUOM = 'in';  // units for Rain ='in', ='mm'
  //  map settings
  $gmMapCenter = '42.8115,10.8984'; // latitude,longitude for initial map center display (decimal degrees)
  $gmMapZoom = 2; // initial map zoom level 2=world, 10=city;
  $gmClusterRadius = 5;     // default =5 number of pixels difference marker points to cluster
                    // should be number from 5 to 80=max clustering
  $gmProvider = 'Esri_WorldTopoMap'; // ESRI topo map - no key needed
  //$gmProvider = 'OSM';     // OpenStreetMap - no key needed
  //$gmProvider = 'Terrain'; // Terrain map by stamen.com - no key needed
  //$gmProvider = 'OpenTopo'; // OpenTopoMap.com - no key needed
  //$gmProvider = 'Wikimedia'; // Wikimedia map - no key needed
  //
  //$gmProvider = 'MapboxSat';  // Maps by Mapbox.com - API KEY needed in $mapboxAPIkey
  //$gmProvider = 'MapboxTer';  // Maps by Mapbox.com - API KEY needed in $mapboxAPIkey
  $mapboxAPIkey = '--mapbox-API-key--';  // use this for the Access Token (API key) to MapBox

  $gmShowFireDanger = false; // =true; show Fire Danger based on Chandler Burning Index; =false don't show

  $doLinkTarget = true; // =true to add target="_blank" to links in popups
  $doRotatingLegends = true; // =true to do rotating legends, =false for no rotating legends on map
//
//end settings
############################################################################


Adjust the settings as guided by the comments next to each variable to configure your display.

----------------------------------------------------------------------------
Installation:

1) unzip the distribution file (preserving the directory structure) to your document root directory

2) upload the ./MESO-images/ directory and contents.

3) Edit your global-map-settings.php for your desired display configuration and upload.
   Note: if using the Saratoga template set, you can use the following entries in Settings.php
   to specify your settings.  They will OVERRIDE the similar settings inside global-map-settings.php

   $SITE['lang']
   $SITE['gmMapZoom']
   $SITE['gmMapCenter']
   $SITE['gmTempUOM']
   $SITE['gmWindUOM']
   $SITE['gmBaroUOM']
   $SITE['gmRainUOM']
   $SITE['gmShowFireDanger']
   $SITE['gmDoRotatingLegends']
   $SITE['gmDoLinkTarget']
   $SITE['gmProvider']
   $SITE['mapboxAPIkey']
   $SITE['gmClusterRadius']

4) Upload (WITHOUT modifications):
   global-map.css
   global-map.js
   global-map.php
   global-map-inc.php
   global-map-lang-inc.php
   global-map-genjs-inc.php
   global-conditions-json.php
   global-links.php
   wxglobal.php
   wxglobal-en.html
 
and these files (which should be writable by PHP with permissions 664 or 666)
   member-count.txt
   members-list-inc.html
   network-links-inc.html
   network-list-inc.html
   global-conditions.json
   

If using the Saratoga template, you can copy wxglobal-en.html to wxglobal-LL.html to add new language support

Also add to the language-LL.txt entries for

langlookup|Global Station Map|Global Station Map|
langlookup|Global Station Map of Affiliated Weather Networks|Global Station Map of Affiliated Weather Networks|
langlookup|Nets|Nets|
langlookup|Weather, Lightning, WebCam|Weather, Lightning, WebCam|
langlookup|Weather, WebCam, Lightning|Weather, WebCam, Lightning|
langlookup|Weather, Lightning|Weather, Lightning|
langlookup|Weather, WebCam|Weather, WebCam|
langlookup|Weather|Weather|
langlookup|Conditions not available|Conditions not available|
langlookup|Temp|Temp|
langlookup|Hum|Hum|
langlookup|DewPT|DewPT|
langlookup|Baro|Baro|
langlookup|About the Global Map|About the Global Map|
langlookup|Affiliated Regional Weather Networks|Affiliated Regional Weather Networks|

Enjoy!
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 gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2573
    • SouthEast Lincoln, NE Weather
Re: Google API billing
« Reply #34 on: August 12, 2018, 09:43:08 PM »
I don't use any language translation on my site, Ken, but this is a persistent problem when I try to implement V4.00 of the global-map script set:
Warning: global-map-lang-inc.php is not usable. Upload an unmodified copy from the global-map.zip distribution.

I've not modified this file, and I'm unable to easily find and correct the problem in the script set.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Google API billing
« Reply #35 on: August 12, 2018, 09:46:29 PM »
You're the second person to experience this.. Hmmm.

Try uploading the global-map-lang-inc.php file in BINARY instead of ASCII and see if that fixes it.  If it doesn't, I'll have to switch to using unserialize(base64_decode(...)) to ensure the character fidelity of the non ISO-8859-1 characters in the file.
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: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Google API billing
« Reply #36 on: August 12, 2018, 10:00:12 PM »
D'Oh.. I discovered a small issue with the program I'd used to scrape the mesonet-map-lang-LL.txt files and create the single global-map-lang-inc.php script.   Try the attached version (unzipped on your site) and see if that fixes the issue.
And.. be sure to upload that file in BINARY mode (not ASCII mode).

I updated the global-map-V4.00.zip file with this already.
« Last Edit: August 12, 2018, 10:16:08 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 gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2573
    • SouthEast Lincoln, NE Weather
Re: Google API billing
« Reply #37 on: August 12, 2018, 10:53:05 PM »
Bingo!  Thanks, Ken.

It wasn't until I uploaded the file in binary (which resulted in a 1 byte difference) with Filezilla that the script set now works.

Great job, which is much appreciated :!: \:D/ =D> :-)
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Google API billing
« Reply #38 on: August 12, 2018, 11:54:45 PM »
Ok, with several folks having issues due to ASCII v.s. BINARY update (and PHP scripts should be uploaded in ASCII),

I decided to fix that issue by using base64 decode, then unserialize to reconstitute the $L language translation array.
Also fixed an issue with global-map-genjs.php where station links wern't working properly on the popups

you can (with this update) now view  global-map-lang-inc.php?sce=view to see the source, and
global-map-lang-inc.php?sce=dump to see the print_r($L) contents of the $L master language array.

Four scripts changed to 4.01:
global-map-lang-inc.php
global-map-settings.php
global-map-inc.php
global-map-genjs-inc.php

Available on the distribution script page or just the update attached.

Thanks for being sports and testing it out!
« Last Edit: August 13, 2018, 12:21:25 AM 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 gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2573
    • SouthEast Lincoln, NE Weather
Re: Google API billing
« Reply #39 on: August 13, 2018, 07:36:18 AM »
Thanks again, Ken!  Updated files loaded in ASCII and working as intended.
Regards, Jerry Wilkins
gwwilk@gmail.com

 

anything