Archive for the ‘service’ Category

Geotag APIs 2

Wednesday, July 28th, 2010

The next step is to dynamically put the photos on the map. I found googlemap API v3 is quite handy and could mock it up in a few hours.
The application can be run also on iPhone and Android phones and automatically locate your current place if the phone support the function.

Photomap

Many photos are taken right on the Bay Bridge, interesting.
Photomap – San Francisco!

Bay Bridge, San Francisco

Geotag APIs

Tuesday, July 27th, 2010

In preparation for the next project, I’m playing around with geotag related APIs.
The first sample I made is a combination of Googlemap and Flickr that shows the photos taken around the place where you click.
It’s interesting to see that there is a considerable variation in numbers of photos taken by location.

In another experiment, I laid out the images from Flickr onto the maps according to their locations.
Again, the numbers of photos available totally depends on the location. So many pictures are overlapped and hidden around the popular places like Ginza, while there are many places with no pictures.
If much more images are placed on a bigger map, like on a A0 print, it will give a great overview of a city.
Clicking on a image shows it in full size (1350 x 1350px).



Google Text-To-Speech API

Saturday, January 2nd, 2010

It turned out to be possible to use Google’s text-to-speech API via HTTP GET request though it’s not yet documented.
According to Weston Ruter, it is as simple as calling http://translate.google.com/translate_tts?tl=en&q=text, and the server returns a MP3 file(‘text’ can be replaced with any arbitrary text less than 100 letters).
So far, it seems only English is supported, but I hope that the API will cover other languages and to be officially available sometime soon.

package {
	import flash.display.*;
	import flash.events.*;
	import flash.media.Sound;
	import flash.net.URLRequest;
	import flash.text.TextField;
	import flash.text.TextFieldType;
	import flash.text.TextFormat;
	import fl.controls.Button;

	public class Main extends Sprite {
		private const REQ_URL_BASE:String="http://translate.google.com/translate_tts?tl=en&q=";
		private var sound:Sound;
		private var inputText:TextField;
		private var button:Button;
		public function Main() {
			addChild(inputText = createTextField());
			inputText.text = "Google text to speech test";
			inputText.x = inputText.y = 10;
			addChild(button = new Button());
			button.x = 10;
			button.y = 90;
			button.label = "Test";
			button.addEventListener(MouseEvent.CLICK, textToSpeech);
		}

		private function textToSpeech(evt:Event = null):void {
			var sound:Sound = new Sound();
			sound.addEventListener(Event.COMPLETE, playSpeech);
			sound.load(new URLRequest(REQ_URL_BASE + encodeURI(inputText.text)));
		}

		private function playSpeech(evt:Event):void {
			evt.target.play();
		}

		private function createTextField():TextField {
			var txt:TextField = new TextField();
			var tf:TextFormat = new TextFormat();
			tf.font = "_sans";
			tf.size = 16;
			tf.color = 666666;
			txt.defaultTextFormat = tf;
			txt.width = 320;
			txt.height = 70;
			txt.border = true;
			txt.multiline = true;
			txt.wordWrap = true;
			txt.maxChars = 100;
			txt.type = TextFieldType.INPUT;
			return txt
		}
	}
}
Related Posts with Thumbnails