분류, 패키지 및 저장소 검색

패키지 상세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를 간단하게 통합할 수 있도록 해주며, 정방향 및 역방향 지리 위치 검색을 가능하게 합니다. 사용자는 주소를 지리적 좌표로 변환하거나 그 반대로 변환할 수 있으며, 안드로이드, iOS, 웹, macOS, Windows, 리눅스 등 여러 플랫폼을 지원합니다. 깔끔하고 사용하기 쉬운 메서드를 통해 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.