usopyon (owner)

Revisions

gist: 44722 Download_button fork
public
Description:
pipesymap
Public Clone URL: git://gist.github.com/44722.git
Embed All Files: show embed
geo_proxy.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/local/bin/ruby -Ke
 
require "open-uri"
require "cgi"
 
cgi = CGI.new
_id = cgi["_id"]
 
if _id == "" then
_id == "FLFeKAKC3RGPFbX61ZzWFw"
end
 
url = 'http://pipes.yahoo.com/pipes/pipe.run?_id='+_id+'&_render=rss'
 
long = 0.0
lat = 0.0
 
open(url){|f|
 
f.each_line{|line|
 
if /xml version/ =~ line then
puts ''
puts '<?xml version="1.0" encoding="utf-8"?>'
elsif /<rss version/ =~ line then
puts ''
puts '<rss version="2.0" xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:ygeorss="http://map.yahoo.co.jp/ygeorss" xmlns:media="http://search.yahoo.com/mrss">'
elsif /<geo:lat>/ =~ line then
lat = line.slice(/<geo:lat>(.*)<\/geo:lat>/,1 )
elsif /<geo:long>/ =~ line then
long = line.slice(/<geo:long>(.*)<\/geo:long>/,1 )
puts ' <ygeorss:point>'+long+' '+lat+'</ygeorss:point>'
puts ' <geo:Point><geo:long>'+long+'</geo:long>'
puts ' <geo:lat>'+lat+'</geo:lat></geo:Point>'
puts ' <georss:point>'+lat+' '+long+'</georss:point>'
#puts ' <ygeorss:code>13113</ygeorss:code>'
else
puts line
end
}
}
 
index.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/local/bin/ruby -Ke
 
require "open-uri"
require "cgi"
 
cgi = CGI.new
_id = cgi["_id"]
 
if _id == "" then
_id = "FLFeKAKC3RGPFbX61ZzWFw"
end
 
print <<HEAD1
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript"
src="http://map.yahooapis.jp/MapsService/js/V2/?appid=FuzoYByxg65Dl6Kht5o1Isl3Pz2Jb2URCsuv_nZIMox9dXP9K.CTT4zHhud6kg--">
</script>
<script type="text/javascript">
window.onload=function(){
_map = new YahooMapsCtrl("map", "35.690734646142,139.69982725435", 6 ,YMapMode.MAP,YDatumType.WGS84);
_map.yGeoRSS(function(){var data = _map.yGeoRSSgetData()});
_map.yGeoRSSsetCategory("L1");
HEAD1
 
print ' _map.yGeoRSSloadXML("http://meme.la.coocan.jp/PipesYMap/geo_proxy.rb?_id='+_id+'");'
 
print <<HEAD2
}
</script>
<title>PipesY!Map</title>
</head>
<body>
HEAD2
 
print <<BODY1
<h1><a href="index.rb">PipesY!Map</a></h1>
<form action="index.rb" method="GET">
http://pipes.yahoo.com/pipes/pipe.info?_id=
<input name="_id" type="input" value=
BODY1
 
print '"'+_id+'"'
 
print <<BODY2
>
<input type="submit" value="submit">
BODY2
 
print '<a href="http://pipes.yahoo.com/pipes/pipe.info?_id='+_id+'">pipes</a>/'
print '<a href="http://meme.la.coocan.jp/PipesYMap/geo_proxy.rb?_id='+_id+'">rss</a>'
 
 
print <<FOOTER
</form>
<div id="map" style="height: 600px; width: 600px"></div>
</body>
</html>
FOOTER