[[Perl]] -http://nlp.kimura-s.otaru-uc.ac.jp/SearchKeyword/googleMaps.cgi #!/usr/bin/perl #参考 http://googlemaps.googlermania.com/google_maps_api_v3/1-2.html print "Content-type: text/html\n\n"; $file = "***.dat"; open(IN,$file); @data = <IN>; close(IN); foreach(@data){ if(/<item>/){ $tmp_lat=0; $tmp_lon=0; $tmp_title=0; } if(/<title>(.*?)<\/title>/){ $tmp_title=$1; } if(/<google:location>iPhone: (\d+\.\d+),(\d+\.\d+)<\/google:location>/){ $tmp_lat = $1; $tmp_lon = $2; if($tmp_title){ $lat = $tmp_lat; $lon = $tmp_lon; $title = $tmp_title; } } } print <<EOF; <html> <head> <title>Hello world in Google Maps API version3</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> function initialize() { var centerPos = new google.maps.LatLng($lat, $lon); var mapOptions = { zoom : 18, center : centerPos, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); var markerOptions = { position : centerPos, map : map, title : "$title" }; var marker = new google.maps.Marker(markerOptions); } </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width:100%;height:100%"></div> </body> </html> EOF