--- title: WebService::SimpleでGoogleMapsのHTTPジオコーディングをリクエスト author: kazu634 date: 2009-06-28 url: /2009/06/28/_1281/ wordtwit_post_info: - 'O:8:"stdClass":13:{s:6:"manual";b:0;s:11:"tweet_times";i:1;s:5:"delay";i:0;s:7:"enabled";i:1;s:10:"separation";s:2:"60";s:7:"version";s:3:"3.7";s:14:"tweet_template";b:0;s:6:"status";i:2;s:6:"result";a:0:{}s:13:"tweet_counter";i:2;s:13:"tweet_log_ids";a:1:{i:0;i:4679;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}' categories: - Perl ---
ゆーすけべーさんが作成しているWebService::SimpleでGoogleMapsのHTTPジオコーディングをリクエストしてみた。
# === Libraries === use strict; use warnings; use YAML; use WebService::Simple; # === Main part === my $geocode = WebService::Simple->new( base_url => "http://maps.google.com/maps/geo", param => { output => 'xml', hl => 'ja', ie => 'UTF8', oe => 'UTF8', } ); my $response = $geocode->get( { q => '仙台', } ); print Dump $response->parse_response();
~/working/tmp_perl/projects/scrape/starbucks on simoom634 [558] $: perl geocoding.pl Wide character in print at geocoding.pl line 24. --- Response: Placemark: p1: AddressDetails: Accuracy: 9 Country: AddressLine: 仙台駅(宮城) CountryName: 日本 CountryNameCode: JP xmlns: urn:oasis:names:tc:ciq:xsdschema:xAL:2. ExtendedData: LatLonBox: east: 140.8851966 north: 38.2634446 south: 38.2571494 west: 140.8789014 Point: coordinates: '140.8820490,38.2602970,0' address: 日本仙台駅(宮城) p2: AddressDetails: Accuracy: 4 Country: AdministrativeArea: AddressLine: 仙台 AdministrativeAreaName: 宮城県 CountryName: 日本 CountryNameCode: JP xmlns: urn:oasis:names:tc:ciq:xsdschema:xAL:2. ExtendedData: LatLonBox: east: 140.8945506 north: 38.2573096 south: 38.2510144 west: 140.8882554 Point: coordinates: '140.8914030,38.2541620,0' address: '日本宮城県, 仙台' p3: AddressDetails: Accuracy: 4 Country: AdministrativeArea: AddressLine: 仙台 AdministrativeAreaName: 鹿児島県 CountryName: 日本 CountryNameCode: JP xmlns: urn:oasis:names:tc:ciq:xsdschema:xAL:2. ExtendedData: LatLonBox: east: 130.3027536 north: 31.8113086 south: 31.8050134 west: 130.2964584 Point: coordinates: '130.2996060,31.8081610,0' address: '日本鹿児島県, 仙台' p4: AddressDetails: Accuracy: 9 Country: AddressLine: 仙台(宮城)(地下鉄) CountryName: 日本 CountryNameCode: JP xmlns: urn:oasis:names:tc:ciq:xsdschema:xAL:2. ExtendedData: LatLonBox: east: 140.8830496 north: 38.2627856 south: 38.2564904 west: 140.8767544 Point: coordinates: '140.8799020,38.2596380,0' address: 日本仙台(宮城)(地下鉄) p5: AddressDetails: Accuracy: 4 Country: AdministrativeArea: AdministrativeAreaName: 河南省 Locality: DependentLocality: AddressLine: 仙台镇 DependentLocalityName: 叶县 LocalityName: 平頂山市 CountryName: 中華人民共和国 CountryNameCode: CN xmlns: urn:oasis:names:tc:ciq:xsdschema:xAL:2. ExtendedData: LatLonBox: east: 113.4589689 north: 33.5313692 south: 33.5250740 west: 113.4526737 Point: coordinates: '113.4558213,33.5282216,0' address: 中華人民共和国河南省平頂山市叶县仙台镇 p6: AddressDetails: Accuracy: 9 Country: AdministrativeArea: AdministrativeAreaName: 北京 DependentLocality: AddressLine: 仙台 DependentLocalityName: 怀柔区 CountryName: 中華人民共和国 CountryNameCode: CN xmlns: urn:oasis:names:tc:ciq:xsdschema:xAL:2. ExtendedData: LatLonBox: east: 116.6846597 north: 40.2848593 south: 40.2785641 west: 116.6783645 Point: coordinates: '116.6815121,40.2817117,0' address: 中華人民共和国北京怀柔区仙台 p7: AddressDetails: Accuracy: 9 Country: AdministrativeArea: AdministrativeAreaName: 山西省 Locality: DependentLocality: AddressLine: 仙台 DependentLocalityName: 介休市 LocalityName: 晋中市 CountryName: 中華人民共和国 CountryNameCode: CN xmlns: urn:oasis:names:tc:ciq:xsdschema:xAL:2. ExtendedData: LatLonBox: east: 112.1005663 north: 37.1093635 south: 37.1030683 west: 112.0942711 Point: coordinates: '112.0974187,37.1062159,0' address: 中華人民共和国山西省晋中市介休市仙台 Status: code: 200 request: geocode name: 仙台 xmlns: http://earth.google.com/kml/2.