Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Highcharts Tides

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Tides

Post by mcrossley »

SpaceWalker wrote:Any chances of getting such a package before the end of year 2013... :lol:
I doubt it, this is low priority - so low I'd forgotten about it until someone PM'd me on another forum yesterday! Like I said if I were to do it again I'd probably use the HighStock variant of HighCharts.

To implement it yourself, the JavaScript is obviously on that demo page, the PHP can be had by using the view-sce option:
https://weather.wilmslowastro.com/test/ ... p?view-sce

The SQL table is really simple...

Code: Select all

--
-- Table structure for table 'tide'
--

CREATE TABLE tide (
  LogDate datetime NOT NULL,
  height decimal(3,2) DEFAULT NULL,
  PRIMARY KEY (LogDate)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
I used a 10 minute time interval, so use wxtide to generate some data, something like

Code: Select all

-incremental 10 -gstart <startdate> -nummonths <num_of_moths_required> -csv -file "filename"
Then edit in an editor and/or spreadsheet to concatenate the date/time values with delimiters etc, and wrap in the SQL statement like 'insert into <table> LogDate=<date-time>, height=<value>'. Or bulk import for example...

Code: Select all

INSERT INTO `tide` (`LogDate`, `height`) VALUES
('2012-12-20 00:00:00', 3.06),
('2012-12-20 00:10:00', 3.19),
('2012-12-20 00:20:00', 3.33),
('2012-12-20 00:30:00', 3.46),
('2012-12-20 00:40:00', 3.59),
('2012-12-20 00:50:00', 3.71),
('2012-12-20 01:00:00', 3.83),
('2012-12-20 01:10:00', 3.95),
And Robert's your father's brother.
Last edited by mcrossley on Tue 25 Aug 2020 10:46 am, edited 2 times in total.
Big Daddy
Posts: 265
Joined: Tue 10 Sep 2013 8:40 pm
Weather Station: Ecowitt GW1003 (GW1000)
Operating System: Raspbian 10 (Buster) / Mono 6.12
Location: Freiston, Lincolnshire, UK
Contact:

Re: Highcharts Tides

Post by Big Daddy »

I really hate to bring up an old topic but just came across this as its my next "project" as I live near the South Coast.

I took a look at Marks webpage and unfortunately its beyond me where to even start.

Did anybody ever implement this and could you give me some help please.

Thanks
Andy
User avatar
nar00ma
Posts: 6
Joined: Tue 01 Jun 2010 6:44 am
Weather Station: Davis Vantage Vue
Operating System: Windows 8.1
Location: Narooma, NSW, Australia
Contact:

Re: Highcharts Tides

Post by nar00ma »

Hi, I have used WxTide32 to generate the data. I works for my location and has data world wide. http://www.wxtide32.com/
You can see the simple output on my side. http://www.ringlandsbay.com
Big Daddy
Posts: 265
Joined: Tue 10 Sep 2013 8:40 pm
Weather Station: Ecowitt GW1003 (GW1000)
Operating System: Raspbian 10 (Buster) / Mono 6.12
Location: Freiston, Lincolnshire, UK
Contact:

Re: Highcharts Tides

Post by Big Daddy »

Sorry to open an old thread but a tide chart has been in my head for a while, especially since the UK Admiralty opened an API
https://admiraltyapi.portal.azure-api.net/

I have signed up and currently put a 7 day table for selected ports of interest on my website but it would be nice to show this in a graph as well but have no idea where to start. I pull down a json file and then extract the data from there but you can get an xml download as well.....if it’s easier.

Andy
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Tides

Post by mcrossley »

Interesting, shame you can't get the documentation without signing up. :bash: It should be fairly straightforward to graph the data though.
Mapantz
Posts: 1775
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Highcharts Tides

Post by Mapantz »

I see I posted a reply 6 years ago lol

I still actively go sea spinning and fishing, so tides are of a great used to me! :D
Image
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Tides

Post by mcrossley »

Here's a quick and dirty use of the API...
https://weather.wilmslowastro.com/test/tides/tides2.php

It caches the API data for 1 hour to minimise API calls - though you are allowed 10,000 calls a month iirc.
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Highcharts Tides

Post by dazza1223 »

is there a download link then mark :D :D
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Tides

Post by mcrossley »

Link added to the demo page.
Big Daddy
Posts: 265
Joined: Tue 10 Sep 2013 8:40 pm
Weather Station: Ecowitt GW1003 (GW1000)
Operating System: Raspbian 10 (Buster) / Mono 6.12
Location: Freiston, Lincolnshire, UK
Contact:

Re: Highcharts Tides

Post by Big Daddy »

Hi Mark,
That’s brilliant and very quick. Thanks so much, that would have taken me weeks to even get just a basic graph.

I will download and have a look tomorrow to try and understand :D

Is it using the straight download of the json file from the Admiralty. From what I read and have downloaded so far, it’s a very basic API but gives the important basic information.

Thanks again.

Andy
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Tides

Post by mcrossley »

Yes, it uses the JSON data, and extracts the time and height info for the graph.

I have a test version that adds high/lowtide to the tooltip rather than the static 'tide' text. It's not working how I would like though, and I'm having a hard time working out how to configure HighStock to do what I want.

The spline curve isn't perfect, particularly at the start/end of the the data, but it gives an rough indication. The API data says that intermediate data is/should be available, but it doesn't appear to be implemented as an as API call yet.
Mapantz
Posts: 1775
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Highcharts Tides

Post by Mapantz »

Question: Where do you find a list of station ID's? I'm having a thick moment.. :lol:
Image
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Tides

Post by mcrossley »

I used the "try it" page for the stations API, you input a port name and it returns the ID and other info.

Now, how you know all the port names... :groan:
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Tides

Post by mcrossley »

Big Daddy
Posts: 265
Joined: Tue 10 Sep 2013 8:40 pm
Weather Station: Ecowitt GW1003 (GW1000)
Operating System: Raspbian 10 (Buster) / Mono 6.12
Location: Freiston, Lincolnshire, UK
Contact:

Re: Highcharts Tides

Post by Big Daddy »

Hi Mark,
I got a chance to look at this tonight. For me it works ok, I just need to make some chamges to colurs, size etc so it fits in with the rest of my website.

A couple of things I noticed.

It didnt immediately load when I put it on my Pi that I use as a webserver. The error seems to be in the first line of tideDemo.php file where it has this:
<?php require 'zbblock.php'; ?>

I dont have that php file so it immediately stalled. Once removed it was ok.

Secondly, it never seems to create a cache file. Have tried entering a cache directory, lets say /var/www/html/tides and hoped it might create as per your notes. Also manually created the directory but it never seems to cache the file. May be my ignorance / inexperience.
[EDIT Have resolved this now. Permissions error on the directory. :bash: ]

And finally, I see you modify the json file thats downloaded to just take out the date and height. Does that also change the formatting of the original file and put it into something like the json files Cumulus uses for tempdata etc. e.g. {"mintemp":[[1545523200000,3.3],[1545609600000,-0.9],[1545696000000,-0.8],[1545782400000,6.3]

I currently use 6 x API calls to get tide data for 6 x ports and was hoping to use something like the weather graphs to generate them on one page (see http://www.midlifedad.me.uk/weather/trends.php) and replacing Temperature, Pressure, Humity etc with the different ports. However the Admirilty API generates things differently and I am not clever enough and dont have the knowledge on how to extract the data and convert it. Any pointers.

Alternative is to have 6 x different php pages based around your scripts.

Thanks again for all your efforts

Andy
Post Reply