(緯度、経度、高度、日付)が何セットか入力されているデータから、Mapreduceを利用してある緯度経度を中心に、半径何メートル以内にあるデータを抽出して一時間ごとのデータの数をファイルに出力するというプログラムをJavaで書きたいです。 WordCountのサンプルプログラムを利用して自分なりに書き換えたのですが、完成出来ません。 2行目の<>内はどのように書き換えれば良いのでしょうか。テキストデータがあるWordCountとは異なり、数字だけのデータなのでStringやtextの代わりにDoubleを使えば良いのでしょうか。 その他、書き直さなければならない点を指摘して頂けると幸いです。 public static class TokenizerMapper extends Mapper{ private final static IntWritable one = new IntWritable(1); private Text word = new Text(); Query query = new Query(); //location(500m circle centred on a Microsoft office) GeoLocation geo = new GeoLocation(0.000000,0.00000); query.setGeoCode(geo, 500, Query.METERS); public void map(Object key, Text value, Context context) throws IOException, InterruptedException { StringTokenizer itr = new StringTokenizer(value.toString()); // make StringTokenizer while (itr.hasMoreTokens()) { // get a token word.set(itr.nextToken()); // text type as key context.write(word, one); // put 1 of IntWritable as value } }
↧