を使用する場合Geo::Coder:Google
、住所から緯度/経度へのマッピングは逆に機能します。
ただし、特に緯度/経度を住所に変換する場合、出力は具体的なフィールドに関する即時アクセスには適していません。
私のデバッグログによると:
loc by lat 48.308472 / lon 14.284578 ---\ {#012 address_components [#012 [0] {#012 long_name "Nibelungenbrücke",#012 short_name "B129",#012 types [#012 [0] "route"#012 ]#012 },#012 [1] {#012 long_name "Landstraße",#012 short_name "Landstraße",#012 types [#012 [0] "neighborhood",#012 [1] "political"#012 ]#012 },#012 [2] {#012 long_name "Innenstadt",#012 short_name "Innenstadt",#012 types [#012 [0] "sublocality",#012 [1] "political"#012 ]#012 },#012 [3] {#012 long_name "Linz",#012 short_name "Linz",#012 types [#012 [0] "locality",#012 [1] "political"#012 ]#012 },#012 [4] {#012 long_name "Linz",#012 short_name "Linz",#012 types [#012 [0] "administrative_area_level_2",#012 [1] "political"#012 ]#012 },#012 [5] {#012 long_name "Upper Austria",#012 short_name "OÖ",#012 types [#012 [0] "administrative_area_level_1",#012 [1] "political"#012 ]#012 },#012 [6] {#012 long_name "Austria",#012 short_name "AT",#012 types [#012 [0] "country",#012 [1] "political"#012 ]#012 },#012 [7] {#012 long_name 4020,#012 short_name 4020,#012 types [#012 [0] "postal_code"#012 ]#012 }#012 ],#012 formatted_address "Nibelungenbrücke, 4020 Linz, Austria",#012 geometry {#012 bounds {#012 n
部分文字列サブを使用すると、気が狂いそうになります。現在、コード:
sub map_latlon_to_loc($$){ my $lat = shift; my $lon = shift;
$location = $geocoder_google->reverse_geocode(latlng => $lat.','.$lon);
dbg("loc by lat ".$lat." / lon ".$lon." --- " . p $location);
}
内の属性にアクセスするのに適した具体的な方法/メソッド/サブはどれ$location
ですか?
ところでp
、プリンターモジュールを指します
CPANでは何も見られません。これでうまくいきます。USだけで機能するわけではありません。私の実装は、どの国にも対応する必要があります。