mapbox_geocoding 0.1.1 copy "mapbox_geocoding: ^0.1.1" to clipboard
mapbox_geocoding: ^0.1.1 copied to clipboard

outdated

Mapbox Geocoding API library in order to make forward and reverse geocoding.

Pub

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.

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"
    
  • add import in your dart code:

    import 'package:mapbox_geocoding/mapbox_geocoding.dart';
    

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';
    }
}

License #

MIT

8
likes
0
pub points
33%
popularity

Publisher

unverified uploader

Mapbox Geocoding API library in order to make forward and reverse geocoding.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

http

More

Packages that depend on mapbox_geocoding