geocoding
v5.0.0A Flutter Geocoding plugin which provides easy geocoding and reverse-geocoding features.
Package archive: https://pubdev.letsnova.ru/api/archives/geocoding/5.0.0.tar.gz
dart pub add geocodingReadme
Flutter Geocoding Plugin
A Flutter Geocoding plugin which provides easy geocoding and reverse-geocoding features.
Important:
- This plugin uses the free Geocoding services provided by the iOS, macOS and Android platforms. This means that there are restrictions to their use. More information can be found in the Apple documentation for iOS and macOS and the Google documentation for Android.
When a
PlatformException(IO_ERROR, ...)gets thrown, most of the times it means that the rate limit has been reached. - The availability of the Google Play Services depends on your country. If your country doesn't support a connection with the Google Play Services, you'll need to try a VPN to establish a connection. For more information about how to work with Google Play Services visit the following link: https://developers.google.com/android/guides/overview
Installing
To use this plugin, please follow the installation guide on the official geocoding plugin page.
Migrating to version 5.0.0
Check out our migration guide when upgrading to version 5.0.0.
Usage
To start using the Geocoding plugin import the geocoding/geocoding.dart package and create an instance of the Geocoding class:
import 'package:geocoding/geocoding.dart';
final Geocoding geocoding = Geocoding();
Use the newly created instance to perform geocoding translations. For example use the Geocoding.placemarkFromCoordinates method to convert latitude and longitude coordinates into a list of addresses (the addressed are sorted on relevance, the first entry in the list is nearest to the coordinates):
// Returns a list of addresses matching the supplied coordinates. The first
// entry in the list is generally the address closest to the supplied
// coordinates.
List<Placemark> placemarks = await geocoding.placemarkFromCoordinates(52.2165157, 6.9437819);
To convert an address into coordinates use the Geocoding.locationFromAddress method:
// Returns a list of latitude / longitude coordinates matching the supplied
// address. The first entry in the list is the coordinate nearest to the
// address.
List<Location> locations = await geocoding.locationFromAddress('Gronausestraat 710, Enschede');
It is also possible to try convert a partial address into a more detailed address using the Geocoding.placemarkFromAddress method:
// Returns a list of placemarks containing addresses matching the
// string "Gronausestraat 710".
List<Placemark> placemarks = await placemarkFromAddress('Gronausestraat 710');
All these methods take an instance of the Locale class, which is used to return the address in the desired locale / language.
Issues
Please file any issues, bugs or feature requests as an issue on our GitHub page. Commercial support is available, you can contact us at hello@baseflow.com.
Want to contribute
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.
Author
This geocoding plugin for Flutter is developed by Baseflow.
Changelog
5.0.0
- BREAKING CHANGES (see our migration guide)
- Wraps all functionality into the
Geocodingclass. - Deprecates the
setLocaleIdentifiermethod in favor of thelocaleparameter of theGeocoding({Locale locale})constructor. - Updates to version 5.0.0 of the
geocoding_platform_interfacepackage, which now allows anullvalue for theLocation.timestampfield as not all platforms (mainly Android) always supply a value. - Updates to version 5.0.0 of the
geocoding_androidpackage which implements the latestgeocoding_platform_interfaceversion. - Updates to version 1.0.0 of the
geocoding_darwinpackage which implements the latestgeocoding_platform_interfaceversion and now includes support for macOS.
- Wraps all functionality into the
4.0.0
- BREAKING CHANGES Please update to Flutter 3.29+ before updating to this version
- Updates Android CompileSDK to 35
- Migrates example project to applying Gradle plugins with the declarative plugins block
- Updates kotlin version to soon minimal supported Kotlin version
1.8.10 - Updates Gradle version to
8.11.1 - Updates iOS Platform version from
11to12 - Updates
geolocator_androiddependency version from3.x.xto4.x.x
3.0.1
- Updated links in README.md to use
httpsprotocol.
3.0.0
- BREAKING CHANGES:
- Locale is no longer part of the
locationFromAddressandplacemarkFromAddress, but should be set first bysetLocaleIdentifier. This was already implemented on Android but is now working similarly on iOS. - Updates documentation related to setting the locale.
- Added
setLocaleIdentifierto the example app. - Updates
geocoding_iosversion to 3.0.0.
- Locale is no longer part of the
2.2.2
- Updates documentation for isPresent().
- Removes unused
LocaleIdentifierparameter for isPresent().
2.2.1+1
- Reverts changes from version
2.2.1,2.2.1should not be used. Use either version2.2.1+1or3.0.0.
2.2.1
- Updates documentation related to setting the locale.
- Added
setLocaleIdentifierto the example app. - Updates
geocoding_iosversion to 3.0.0.
2.2.0
- Exposes the
isPresent()method which on Android returnstrueif the geocoding backend service are present on the device, otherwise returnsfalse. On iOS this method always returnstrue.
2.1.1
- Updates the example app, so the
example/lib/main.dartcontains clear example code on how to use the geocoding plugin. Mean reason for doing so is that theexample/lib/main.dartis shown in the "Example" tab on pub.dev.
2.1.0
- Upgrades the app-facing package to use the federated architecture.
2.0.6
- Upgrades
compileSdkVersionto33on Android. - Fix issues in example project.
2.0.5+1
- Update pub.dev links.
2.0.5
- Fixed #58 getting locationFromAddress freezes main thread.
2.0.4
- Fixes link to the Android migration guide in README.
2.0.3
- Upgrades
compileSdkVersionto31on Android. - Resolves Android embedding deprecation warning.
2.0.2
- Migrate maven repository from jcenter to mavenCentral.
2.0.1
- Update the plugin version number in the README file to the newest version;
- Update the example app to use
compileSdkversion 30andtargetSdkversion 30in thebuild.gradle.
2.0.0
- Migrate to null safety.
1.0.5
- Make sure the README.md specifies the correct links to Apple's CLGeocoder and Android's Geocoder APIs (see #20);
- Update the documentation to mention correct usage for the
locationFromAddressfeature (see #21)
1.0.4+1
- Make sure the README.md mentions the correct version number.
1.0.4
- Added NoResultFoundException to indicate when no results are found, instead of PlatformException
1.0.3+1
- Make sure the supplied locale is respected (see issue #10)
1.0.3
- Make sure public types defined in the geocoding_platform_interface are also available from the geocoding package (see #6).
1.0.2
- Solve
IllegalFormatConversionExceptionon Android when geocoding request could not be resolved (see #5).
1.0.1
- Pimp the example application
1.0.0
- Initial open-source release
