カテゴリー・パッケージ・リポジトリを検索

パッケージ詳細v1.5.2

google_geocoding_api

このパッケージは、デフォルトおよびリバースジオサーチを備えたGoogleジオコーディングAPIを実装しています

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
1.3万
いいね数
41
Pub ポイント
160

パッケージをインストール

flutter pub add google_geocoding_api

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

google_geocoding_api パッケージは、Flutter アプリケーションに Google のジオコーディング API を簡単に統合する方法を提供し、フォワードおよびリバースジオロケーション検索を可能にします。ユーザーは住所を地理座標に変換したり、その逆も行うことができ、Android、iOS、Web、macOS、Windows、Linux など複数のプラットフォームをサポートしています。明確で使いやすいメソッドにより API インタラクションを簡素化しており、アプリ内の場所ベースの機能に最適です。正常に動作させるには有効な Google Cloud Platform API キーが必要です。

用途

  • 住所から座標への変換
  • 場所の詳細の逆ジオコーディング
  • 地図ベースのアプリの場所検索
  • 場所を認識する天気アプリ
  • 配達および物流トラッキング

主な機能

  • フォワードおよびリバースジオコーディングをサポート
  • クロスプラットフォーム互換性
  • シンプルな API インテグレーション
  • 組み込みのエラー処理
  • Google Cloud API キーが必要です

適している対象

  • 位置サービスが必要なモバイルおよびウェブアプリ
  • 住所の解析を必要とするアプリ
  • Google Maps バックエンドを使用する開発者
  • 場所ベースの分析ツール
  • リアルタイムナビゲーションアプリ

注意事項

  • Google Cloud Platform API キーが必要です
  • 照会に基づいて使用料が発生する可能性があります
  • レート制限が適用されています
  • インターネット接続が必要です
  • プロダクション環境ではAPIキーを保護する必要があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Pub License: MIT

Buy Me A Coffee


Introduction

This package implement Google Geocoding API with only dart dependency(without flutter).
Before working with the package, be sure to read Before you begin and create an API key in Google Developer Console.

USAGE

Geocoding (latitude/longitude lookup)

This is example code how to use Geocoding Search. Before use it please read Geocoding (latitude/longitude lookup)

import 'package:google_geocoding_api/google_geocoding_api.dart';

Future<void> main() async {
  const String googelApiKey = 'YOUR_API_KEY';
  final bool isDebugMode = true;  
  final api = GoogleGeocodingApi(googelApiKey, isLogged: isDebugMode);  
  final searchResults = await api.search(
    'Boston',
    language: 'en',
  );
}

Reverse geocoding (address lookup)

This is example code how to use Geocoding Reverse Search. Before use it please read Reverse geocoding (address lookup)

import 'package:google_geocoding_api/google_geocoding_api.dart';

Future<void> main() async {
  const String googelApiKey = 'YOUR_API_KEY';
  final bool isDebugMode = true;  
  final api = GoogleGeocodingApi(googelApiKey, isLogged: isDebugMode);  
  final reversedSearchResults = await api.reverse(
    '42.360083,-71.05888',
    language: 'en',
  );
}

Place geocoding

This is example code how to use Place Geocoding. Before use it please read Place Geocoding

import 'package:google_geocoding_api/google_geocoding_api.dart';

Future<void> main() async {
  const String googelApiKey = 'YOUR_API_KEY';
  final bool isDebugMode = true;  
  final api = GoogleGeocodingApi(googelApiKey, isLogged: isDebugMode);  
  final placeSearchResults = await api.placeGeocoding(
    'ChIJd8BlQ2BZwokRAFUEcm_qrcA',
    language: 'en',
  );
}

Pretty Address

Now you can use .mapToPretty() to get an instance of GeocodingPrettyAddress instance containing address, city, country, latitude, longitude, postalCode, state, countryCode, streetNumber, streetName, placeId.

Attention: The feature is experimental and may not work exactly as you need. Any suggestions for improvement may be written in the Issue Tracker.

  final placeSearchResults = await api.placeGeocoding(
    'ChIJd8BlQ2BZwokRAFUEcm_qrcA',
    language: 'en',
  );
  
  final prettyAddress = placeSearchResults.results.firstOrNull?.mapToPretty();

  if (prettyAddress == null) {
    return null;
  }

  print(prettyAddress.postalCode);
  print(prettyAddress.streetNumber);
  print(prettyAddress.streetName);
  print(prettyAddress.city);
  print(prettyAddress.state);
  print(prettyAddress.placeId);
  print(prettyAddress.country);
  print(prettyAddress.address);
  print(prettyAddress.countryCode);
  print(prettyAddress.latitude);
  print(prettyAddress.longitude);

Contact and bugs

Use Issue Tracker for any questions or bug reports.

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。