SageTV Community

SageTV Community (http://forums.sagetv.com/forums/index.php)
-   SageTV Australia/New Zealand (http://forums.sagetv.com/forums/forumdisplay.php?f=21)
-   -   Traffic congestion and traffic cams (http://forums.sagetv.com/forums/showthread.php?t=32397)

zzmystique 04-23-2008 05:37 PM

Traffic congestion and traffic cams
 
Would like to add Traffic congestion and traffic cams information for Auckland to the Online services Menu - from the urls below. Any ideas on how to
achieve it? Thanks

====
traffic cams
northcote road
http://metservice.co.nz/default/inde...r_auck_nthcote
http://traffic.transit.govt.nz/ViewCamera.do?id=30
tristram ave
http://metservice.co.nz/default/inde..._auck_tristram
http://traffic.transit.govt.nz/ViewCamera.do?id=20
onewa road
http://metservice.co.nz/default/inde...=tr_auck_onewa
http://traffic.transit.govt.nz/ViewCamera.do?id=50
Esmonde Road
http://traffic.transit.govt.nz/ViewCamera.do?id=40

congestion info
http://traffic.transit.govt.nz/Traff...iew=congestion
====

JREkiwi 04-23-2008 11:57 PM

I used to use the Weather Suite customization to show them, but I think the last time I used it I was running SageTV 5. If you can get the basic Weather Suite running I can provide some config files.

John

doc 04-24-2008 08:34 AM

Anne

I dont know how you got on adding the following lines into the client properties file.

sagemc/wximage_title_1=Traffic Cam Northcote Road
sagemc/wximage_title_2=Traffic Cam Tristram Ave
sagemc/wximage_title_3=Traffic Cam Onewa Road
sagemc/wximage_title_4=Traffic Cam Esmonde Road
sagemc/wximage_url_1=http\://traffic.transit.govt.nz/ViewCameraImage.do?id=30
sagemc/wximage_url_2=http\://traffic.transit.govt.nz/ViewCameraImage.do?id=20
sagemc/wximage_url_3=http\://traffic.transit.govt.nz/ViewCameraImage.do?id=50
sagemc/wximage_url_4=http\://traffic.transit.govt.nz/ViewCameraImage.do?id=40


But the last pic you were on about has a base picture, and the green/yellow/red lines are super-imposed on top.

The only way I could think of generating the pic to display is to use
converthtmltoimage to copy the webpage to a bmp file, and then use irfanview to crop it to the right size.

To do this...

Download ConvertHTMLtoImage_Trial.exe from http://www.converthtmltoimage.com/Download.html

(The trial works, but leaves a small watermark on the picture)


Install irfanview 4.10 from
http://www.irfanview.com/

Create a batch file with lines similar to below, depending on where you run it from.

"c:\program files\convert html to image\ConvertHTMLtoImage.exe" /url traffic.transit.govt.nz/Traffic.do?view=congestion /delay 5 /format bmp /name output.bmp

"c:\program files\irfanview\i_view32" "C:\program files\convert html to image\output.bmp" /crop=(187,133,310,478) /convert="C:\program files\convert html to image\output.jpg"



Once you've created the jpg file, you can then add a couple of extra lines to the properties file to point to this jpg file.

I can't test any of this until the weekend, so let me know if any of it works.

If anyone else knows of an easier way to do this, I'm all ears!

doc 04-24-2008 01:29 PM

1 Attachment(s)
OK, here goes. It took me all day at work to get this working!!!!!!

It works on my test pc running SageMC. I haven't tested it on an MVP though.

Copy the following lines into sage.properties on ther server.
For your MVP I guess you'd copy them into the appropriate properties file in the clients folder instead.

sagemc/wximage_title_1=Northcote Road
sagemc/wximage_title_2=Tristram Ave
sagemc/wximage_title_3=Onewa Road
sagemc/wximage_title_4=Esmonde Road
sagemc/wximage_title_5=Congestion Map
sagemc/wximage_title_6=
sagemc/wximage_title_7=
sagemc/wximage_url_1=http\://traffic.transit.govt.nz/ViewCameraImage.do?id\=30
sagemc/wximage_url_2=http\://traffic.transit.govt.nz/ViewCameraImage.do?id\=20
sagemc/wximage_url_3=http\://traffic.transit.govt.nz/ViewCameraImage.do?id\=50
sagemc/wximage_url_4=http\://traffic.transit.govt.nz/ViewCameraImage.do?id\=40
sagemc/wximage_url_5=c\:\\batch\\output.jpg
sagemc/wximage_url_6=
sagemc/wximage_url_7=


If you already have entries in there, you can delete them.
If you omit the whole lines for 6 & 7, SageMC will create them and point them to weather for the states. If you want them blank, leave them as shown above.
If you want other images, then add them like the other ones.

Form the Congestion Map, SageMC will load the picture c:\batch\output.jpg

On the congestion map web page there is a jpeg picture, but the green, yellow and red lines are superimposed on top of it, so you can't just point to the map.

The only thought I had was to take a screen print of the web page, and then crop the image to use just the bit required.

This is a bit long winded and there may be better ways of doing it, but it works.

Firstly, install
ConvertHTMLtoImage from http://www.converthtmltoimage.com/Download.html (the trial version will do)
and irfanview from http://www.irfanview.com

I created a folder c:\batch, and made a batch file in it that had the following lines in it.

del "c:\program files\convert html to image\output.bmp"
del c:\batch\output.jpg

"c:\program files\convert html to image\ConvertHTMLtoImage.exe" /url traffic.transit.govt.nz/Traffic.do?view=congestion /delay 5 /format bmp /name output.bmp

"c:\program files\irfanview\i_view32" "C:\program files\convert html to image\output.bmp" /crop=(187,133,310,478) /convert="C:\batch\output.jpg"


When you run this batch file, it will create the output.jpg file that SageMC will display on the screen.

You could create a scheduled task to run this batch file every 10 or 15 minutes between certain times of the day.

A good time would be before picking someone up at the airport :p

I'm not sure how often that congestion map is updated - it says 8:08 pm and the cams show up as 7.24 am. The watermark is because its the trial version of converthtmltoimage, but I'd guess you could live with that.

Let me know how you get on.

Doc

zzmystique 04-24-2008 09:28 PM

Doc - Followed your instructions - then renamed the .properties file in the client folder on the server - reloaded the Sagemc customisation on the MVP. All seems to be working. Thankyou. :jump:

John - Do you have NZ map info like US ones? Thanks

Anne

doc 04-25-2008 07:12 AM

Anne

I've found 2 maps that might be of interest, but theres not a great deal about really.

Add these lines to the properties file along with the previous ones.

sagemc/wximage_title_6=Satellite Image
sagemc/wximage_title_7=Rain Map
sagemc/wximage_url_6=http\://image.weather.com/images/sat/new_zealsat_720x486.jpg
sagemc/wximage_url_7=c\:\\batch\\rain.jpg

and add the following lines to the bath file you made before.

del "c:\program files\convert html to image\rain.bmp"
del c:\batch\rain.jpg

"c:\program files\convert html to image\ConvertHTMLtoImage.exe" /url metservice.co.nz/default/index.php?alias=akradar /delay 5 /format bmp /name rain.bmp

"c:\program files\irfanview\i_view32" "C:\program files\convert html to image\rain.bmp" /crop=(148,305,344,313) /convert="C:\batch\rain.jpg"


Are they of any use?

doc 04-28-2008 02:28 AM

Anne

I found a different satellite image thats more local than the other one, but its in black and white :(

If you want to try it, generate the jpg file in the same way as the others

del "c:\program files\convert html to image\satellite.bmp"
del c:\batch\satellite.jpg

"c:\program files\convert html to image\ConvertHTMLtoImage.exe" /url metservice.co.nz/default/index.php?alias=vissatellitelatest /delay 5 /format bmp /name satellite.bmp

"c:\program files\irfanview\i_view32" "C:\program files\convert html to image\satellite.bmp" /crop=(148,305,339,467) /convert="C:\batch\satellite.jpg"


I've removed the 'www.' from the front of the URL so that it displays correctly. It also seems to work ok without it, so theres no need to put it at the beginning.

You'll have to remove one of the other maps as there appears to be a limit of 7.

zzmystique 04-29-2008 04:36 AM

Thanks Doc

Will check it out and see which map I prefer.

Anne

JREkiwi 05-15-2008 02:29 AM

Quote:

Originally Posted by zzmystique (Post 279110)
John - Do you have NZ map info like US ones?

Anne, sorry for the lack of reply, but no I don't have one. Not only that but I can't find my configuration file that I did have. :bang:

John

zzmystique 05-23-2008 03:03 AM

Not a problem John, thanks for looking.

Anne


All times are GMT -6. The time now is 09:39 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.