nominatim_flutter 패키지는 Flutter 애플리케이션에서 Nominatim 지오코딩 서비스와의 원활한 통합을 제공합니다. 역지오코딩, 정방향 장소 검색, 상태 확인 및 여러 플랫폼 간 위치 조회를 가능하게 합니다. 정확한 지리 데이터 검색이 필요한 개발자를 위해 설계되었으며, 오픈소스 Nominatim API와의 상호작용을 단순화합니다. Android, iOS, macOS, Windows, Linux를 지원하여 크로스플랫폼 지오로케이션 기능에 이상적입니다. 간단한 API를 통해 주소 해석 또는 맵 기반 위치 서비스가 필요한 앱을 강화합니다.
사용 사례
좌표에서의 역지역화
주소의 정방향 지리 인코딩
쿼리에 의한 위치 검색
실시간 주소 제안
지역 기반 앱 기능
주요 기능
크로스 플랫폼 지원
Nominatim을 위한 간단한 API
상태 및 오류 처리
비동기 요청 관리
경량이고 효율적
적합한 대상
지도 및 내비게이션 앱
위치 인식 서비스
주소 검색 기능
여행 및 배송 앱
개발자 프로토타이핑
고려 사항
인터넷 연결이 필요합니다
무료 Nominatim 인스턴스의 속도 제한
성능을 위해 캐싱이 권장됩니다
고사용량에는 API 키가 필요할 수 있습니다
외부 Nominatim 서비스의 가용성에 의존
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Nominatim Flutter Plugin with Isolate Loading & Hive Caching
The Nominatim Flutter Plugin offers seamless interaction with the Nominatim service, allowing for reverse geocoding and place searching in your Flutter applications. Notably, it supports asynchronous data loading via a dedicated isolate and provides efficient caching using Hive, enhanced with DioCache customization.
Note on Sovereignty
The Hoàng Sa (Paracel Islands) and Trường Sa (Spratly Islands) are unequivocally part of Vietnam. The Nominatim Flutter Plugin ensures that any information contradicting this fact is overridden to reflect the historical and territorial integrity of Vietnam. This feature embodies the developer's commitment to accuracy and national pride.
Features
Reverse Geocoding & Place Searching: Directly integrate with Nominatim.
Check Server Status: Verify the operational status of the Nominatim server.
Lookup: Retrieve detailed information about specific places using unique identifiers (OSM IDs).
Custom Server Support: Connect to your own Nominatim instance instead of the default OpenStreetMap server.
Asynchronous Isolate Loading: Load data in a separate thread, ensuring your UI remains smooth.
Hive Caching: Speed up data retrieval with efficient caching.
Nominatim Configuration: Take control of caching behavior and other settings by configuring Nominatim preferences.
Curl Logging: Enhance debugging and monitoring by logging HTTP requests and responses made via cURL.
Usage
To use the Nominatim Flutter Plugin, follow these steps:
Installation: Add the package to your pubspec.yaml file and run flutter pub get to install it.
dependencies:nominatim_flutter:^0.0.8# Replace with the latest version
Import Classes: Import the necessary classes in your Dart code.
Configuration (Optional): Before you start making requests, you can optionally set up caching preferences and other settings.
// Configure Nominatim settings (recommended approach)NominatimFlutter.instance.configureNominatim(
useCacheInterceptor: true,
maxStale: Duration(days: 7),
baseUrl: 'https://your-nominatim-server.com', // Optional: use custom Nominatim server
userAgent: 'YourApp/1.0',
enableCurlLog: true, // Enable cURL logging for debugging
printOnSuccess: true, // Log successful requests
convertFormData: true,
);
// Or use the legacy cache configuration (deprecated)NominatimFlutter.instance.configureDioCache(
useCacheInterceptor: true,
maxStale: Duration(days: 7),
);
This step allows you to determine whether the cache interceptor is used, set the maximum staleness of the cache, configure a custom Nominatim server URL, and enable debug logging.
Reverse Geocoding: Retrieve address information from latitude and longitude coordinates.
final reverseRequest = ReverseRequest(
lat: 10.7950,
lon: 106.7218,
addressDetails: true,
extraTags: true,
nameDetails: true,
);
final reverseResult = awaitNominatimFlutter.instance.reverse(
reverseRequest: reverseRequest,
language: 'en-US,en;q=0.5', // Specify the desired language(s) here
);
print(reverseResult);
Search for Places: Search for places based on query and location.
final searchRequest = SearchRequest(
query: 'Landmark 81',
limit: 3,
addressDetails: true,
extraTags: true,
nameDetails: true,
);
final searchResult = awaitNominatimFlutter.instance.search(
searchRequest: searchRequest,
language: 'en-US,en;q=0.5', // Specify the desired language(s) here
);
for (var result in searchResult) {
print(result);
}
Check Server Status: Verify the status of the Nominatim server to ensure it is operational.
final statusResult = awaitNominatimFlutter.instance.status();
if (statusResult.status == Status.ok) {
print('Nominatim server is operational.');
} else {
print('Nominatim server is down.');
}
Lookup: Retrieve detailed information about a specific place using its unique identifier (OSM ID).
final lookupRequest = LookupRequest(
osmIds: 'R146656,W104393803,N240109189', // Replace with actual OSM IDs
addressDetails: true,
extraTags: true,
nameDetails: true,
);
final lookupResult = awaitNominatimFlutter.instance.lookup(
lookupRequest: lookupRequest,
language: 'en-US,en;q=0.5', // Specify the desired language(s) here
);
for (var result in lookupResult) {
print(result);
}
Contributions: Contributions are welcome! If you encounter any issues or have suggestions for improvements, please feel free to submit a pull request or create an issue on the GitHub repository.
License: This project is licensed under the GPL-3.0 License. Refer to the LICENSE file for details.
Remember to replace the version number (^0.0.8) with the actual version of your Nominatim Flutter Plugin. Customize the usage examples and other sections according to your project's needs.