Welcome to the Cumulus Support forum.

Latest Cumulus MX release v3.0.0 build 3048 - 02 March 2019.
Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014

See the Wiki for downloading either version.

Highcharts Tides

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

Moderator: daj

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

Re: Highcharts Tides

Post by mcrossley » Mon 09 Dec 2013 1:34 pm

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:
http://weather.wilmslowastro.com/tideTable.php?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 Fri 17 Jul 2015 3:37 pm, edited 1 time in total.

Big Daddy
Posts: 72
Joined: Tue 10 Sep 2013 8:40 pm
Weather Station: Maplin N96FY
Operating System: Windows 8
Location: Freiston, Lincolnshire, UK

Re: Highcharts Tides

Post by Big Daddy » Fri 17 Jul 2015 1:40 pm

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 » Fri 02 Oct 2015 11:49 pm

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: 72
Joined: Tue 10 Sep 2013 8:40 pm
Weather Station: Maplin N96FY
Operating System: Windows 8
Location: Freiston, Lincolnshire, UK

Re: Highcharts Tides

Post by Big Daddy » Fri 28 Dec 2018 7:03 pm

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: 5408
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Tides

Post by mcrossley » Fri 28 Dec 2018 8:24 pm

Interesting, shame you can't get the documentation without signing up. :bash: It should be fairly straightforward to graph the data though.

Mapantz
Posts: 565
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 10 x64
Location: null

Re: Highcharts Tides

Post by Mapantz » Fri 28 Dec 2018 9:05 pm

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: 5408
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Tides

Post by mcrossley » Sat 29 Dec 2018 3:40 pm

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: 496
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Vue
Operating System: raspberry pi 3 +
Location: worthing
Contact:

Re: Highcharts Tides

Post by dazza1223 » Sat 29 Dec 2018 5:54 pm

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

dazza :D

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

Re: Highcharts Tides

Post by mcrossley » Sat 29 Dec 2018 7:03 pm

Link added to the demo page.

Big Daddy
Posts: 72
Joined: Tue 10 Sep 2013 8:40 pm
Weather Station: Maplin N96FY
Operating System: Windows 8
Location: Freiston, Lincolnshire, UK

Re: Highcharts Tides

Post by Big Daddy » Sat 29 Dec 2018 8:36 pm

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: 5408
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Tides

Post by mcrossley » Sat 29 Dec 2018 8:51 pm

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: 565
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 10 x64
Location: null

Re: Highcharts Tides

Post by Mapantz » Sun 30 Dec 2018 5:28 pm

Question: Where do you find a list of station ID's? I'm having a thick moment.. :lol:
Image

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

Re: Highcharts Tides

Post by mcrossley » Sun 30 Dec 2018 5:57 pm

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: 5408
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Tides

Post by mcrossley » Sun 30 Dec 2018 6:15 pm


Big Daddy
Posts: 72
Joined: Tue 10 Sep 2013 8:40 pm
Weather Station: Maplin N96FY
Operating System: Windows 8
Location: Freiston, Lincolnshire, UK

Re: Highcharts Tides

Post by Big Daddy » Sun 30 Dec 2018 8:50 pm

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