Kategorien, Pakete und Repositories suchen

Paketdetailsv1.5.2

google_geocoding_api

Dieses Paket implementiert die Google Geocoding-API mit Standard- und Reverse-Geosuche

AndroidiOSWebmacOSWindowsLinux
30-Tage-Downloads
12.600
Likes
41
Pub-Punkte
160

Paket installieren

flutter pub add google_geocoding_api

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

Das google_geocoding_api-Paket bietet eine einfache Möglichkeit, die Google Geocoding-API in Flutter-Anwendungen zu integrieren und sowohl Vorwärts- als auch Rückwärtsgeokodierung durchzuführen. Es ermöglicht die Umwandlung von Adressen in geografische Koordinaten und umgekehrt und unterstützt mehrere Plattformen wie Android, iOS, Web, macOS, Windows und Linux. Das Paket vereinfacht die Interaktion mit der API durch saubere, einfach zu verwendende Methoden und ist ideal für ortsbasierte Funktionen in Apps. Für die Funktionalität wird ein gültiger Google Cloud Platform-API-Schlüssel benötigt.

Anwendungsfälle

  • Adressen in Koordinaten umwandeln
  • Umgekehrte Geokodierung für Standortdetails
  • Kartenbasierte App-Standortsuche
  • Standortbewusste Wetter-Apps
  • Lieferung und Logistikverfolgung

Hauptmerkmale

  • Unterstützt Forward- und Reverse-Geokodierung
  • Plattformübergreifende Kompatibilität
  • Einfache API-Integration
  • Eingebaute Fehlerbehandlung
  • Google Cloud-API-Schlüssel erforderlich

Geeignet für

  • Mobile und Web-Anwendungen, die Standortdienste benötigen
  • Apps, die eine Adressenanalyse erfordern
  • Entwickler, die den Google Maps Backend verwenden
  • Standortbasierte Analysetools
  • Echtzeit-Navigationsanwendungen

Hinweise

  • Benötigt einen Google Cloud Platform-API-Schlüssel
  • Kann je nach Abfrage Nutzungskosten verursachen
  • Geschwindigkeitsbegrenzungen gelten
  • Internetverbindung erforderlich
  • API-Schlüssel müssen in der Produktion gesichert werden

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

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.

Kategorien

Abhängigkeiten

Abhängigkeiten 1 Einträge

Quell-Repository

Projekte, die dieses Paket verwenden

Noch keine Daten verfügbar.