mapbox_geocoding 0.1.3
mapbox_geocoding: ^0.1.3 copied to clipboard

Dart native js
Flutter Android iOS Linux macOS web Windows

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.

Table of Contents #

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

5
likes
100
pub points
70%
popularity

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

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

berkayoruc0@gmail.com

License

MIT (LICENSE)

Dependencies

http

More

Packages that depend on mapbox_geocoding