mapbox_geocoding

Last updated:

0 purchases

mapbox_geocoding Image
mapbox_geocoding Images
Add to Cart

Description:

mapbox geocoding

Dart Mapbox Geocoding API (not official) #
A Flutter package Mapbox Geocoding API. Package is not official product of mapbox.
This project is a library to use Mapbox Geocoding API from dart scripts.
Table of Contents #

Documentation
Usage
License


Documentation #
Library documentation is here.

Usage #
To use this library in your code:


add a dependency in your pubspec.yaml :
dependencies:
mapbox_geocoding: "^last_version"
copied to clipboard


add import in your dart code:
import 'package:mapbox_geocoding/mapbox_geocoding.dart';
copied to clipboard


Please create/use Mapbox account to obtain Mapbox access token.
If you have Mapbox account, you can reach access token from Mapbox account dashboard.
A very simple example :
import 'package:mapbox_geocoding/mapbox_geocoding.dart';
import 'package:mapbox_geocoding/model/forward_geocoding.dart';

MapboxGeocoding geocoding = MapboxGeocoding('YOUR_ACCESS_TOKEN');

///Forward geocoding. Get latitude and longitude from place name.
getCoordinates(String city) async {
try {
ForwardGeocoding forwardModel = await geocoding.forwardModel(city);
return forwardModel.features[0].center;
} catch (Excepetion) {
return 'Forward Geocoding Error';
}
}
///Reverse geocoding. Get place name from latitude and longitude.
getCity(double lat, double lng, String apiKey) async {
try {
ReverseGeocoding reverseModel = await geocoding.reverseModel(lat, lng);
return reverseModel.features[0].placeName;
} catch (Excepetion) {
return 'Reverse Geocoding Error';
}
}
copied to clipboard

License #
MIT

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.