User:Inge Hoonte/shippingnews: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
CODE:
[[File:CAPEWATER_ENG_ZOOMOUT.png]]
 
[[File:CAPEWATER_ENG.png]]
 
 
 
== CODE ==
currently linked to the marinetraffic log. Want to improve and specify location to traffic map to other sources. What else happened in this location? Pull from web, and perhaps shipping logs.


  #!/usr/bin/env python
  #!/usr/bin/env python
Line 55: Line 63:
  '''
  '''


web page: http://pzwart3.wdka.hro.nl/~ihoonte/cgi-bin/script.cgi?a=rotterdam%2C+nl
"Data is provided for informational reasons only and is not related by any means to the safety of navigation. All rights reserved. No part of MarineTraffic may be copied, reproduced or retransmitted in any material and form or by any other means, without the prior written permission of the Scientific Head of MarineTraffic project."
 
For now I'm not putting the cgi script link here, because I might want to work with MarineTraffic to get to data better.

Latest revision as of 18:45, 4 March 2011

CAPEWATER ENG ZOOMOUT.png

CAPEWATER ENG.png


CODE

currently linked to the marinetraffic log. Want to improve and specify location to traffic map to other sources. What else happened in this location? Pull from web, and perhaps shipping logs.

#!/usr/bin/env python
#-*- coding:utf-8 -*-
print "Content-Type: text/html"
print
import urllib2, json, sys, cgi, urllib
import cgitb; cgitb.enable()

args = cgi.FieldStorage()
t = args.getvalue('a', )

#command line is with argv[0], cgi.FieldStorage() = for cgi
 
url = 'http://maps.googleapis.com/maps/api/geocode/json?address='+urllib.quote(t)+'&sensor=true'
#urllib.quote allows you to enter spaces and it interprets it as url code. eg space=%2C
f = urllib2.urlopen(url)
data = json.load(f)

for r in data['results']:
   print "(%s, %s)" % (r['geometry']['location']['lat'], r['geometry']['location']['lng'])
   
print 

<form action= method='get'>

<input type='text' value='type location here' name='a' />
<input type='submit'  value='submit'>

</form>

<script type="text/javascript">
       width='80%';         
       height=400;         
       border=1;           
       notation=false;     
       shownames=false;    
       latitude=
       
print r['geometry']['location']['lat']
print ;  
       longitude=
       
print r['geometry']['location']['lng']
print         
       ;  
       zoom=10;            
       maptype=3;         
       trackvessel=13;      
       fleet=;           
       remember=false;   
</script>
<script type="text/javascript" src="http://www.marinetraffic.com/ais/embed.js"></script>


"Data is provided for informational reasons only and is not related by any means to the safety of navigation. All rights reserved. No part of MarineTraffic may be copied, reproduced or retransmitted in any material and form or by any other means, without the prior written permission of the Scientific Head of MarineTraffic project."

For now I'm not putting the cgi script link here, because I might want to work with MarineTraffic to get to data better.