geocode 0.1.1
geocode: ^0.1.1

Dart native js
Flutter Android iOS web

Package to make Geocode requests. It exposes two methods to translate coordinates into locations and addresses into coordinates.

Geocode library #

workflow name

Introduction #

Package to make Geocode requests. It exposes two methods to translate coordinates into locations and addresses into coordinates.

It's a basic implementation of the most useful methods in the Dart language of the following API geocode.xyz.

It's free for one request per second quota. Register in the above site to get an API Key and increase the number of requests to 10 per second. These are paid plans that allow more requests per second. For more information, review the site.

Installation #

dependecies:
  geocode: ^0.1.1

Example #

See example/main.dart

import 'package:geocode/geocode.dart';

void main() async {
  GeoCode geoCode = GeoCode();

  try {
    Coordinates coordinates = await geoCode.forwardGeocoding(
        address: "532 S Olive St, Los Angeles, CA 90013");

    print("Latitude: ${coordinates.latitude}");
    print("Longitude: ${coordinates.longitude}");
  } catch (e) {
    print(e);
  }
}

Methods #

Constructor #

Library GeoCode class constructor, includes an optional parameter to set the apiKey.

GeoCode({this.apiKey});

Reverse Geocode #

Method to translate a pair of latitude and longitude coordinates into a real address.

Future<Address> reverseGeocoding({double latitude, double longitude})

Forward Geocode #

Method to translate an address into a pair of latitude and longitudecoordinates.

Future<Coordinates> forwardGeocoding({String address})

Responses #

Reverse Geocode #

AttributeTypeDescription
elevationdoubleThe elevation in meters.
timezoneStringThe timezone.
geoNumberintgeocode is an alphanumeric string representing both latitude and longitude as one value. Nearby points will have similar geocodes.
streetNumberintThe properly formated street address number to be returned.
streetAddressStringThe properly formated street address to be returned.
cityStringThe properly formated city name to be returned.
countyCodeStringThe properly formated country code to be returned.
countryNameStringThe properly formated country name to be returned.
regionStringThe properly formated region to be returned.
postalStringThe properly formated postal code to be returned.
distancedoubleThe distance of the result location from the input location.

Forward Geocode #

AttributeTypeDescription
latitudedoubleLatitude coordinate value.
longitudedoubleLongitude coordinate value.

Exceptions #

  • AccountOutOfCreditsException: auth has ran out of credits.
  • AuthTokenNotFoundException: authentication token: auth not found.
  • PostalCodeFormatException: postal Code is not in the proper Format.
  • RequestThrottledException: request Throttled.
  • InvalidQueryException: supply a valid query.
  • EmptyResultException: your request did not produce any results. Check your spelling and try again.
  • UnknownErrorException: unkown error.

Dependencies #

http: ^0.12.2

License #

BSD 3-Clause License

1
likes
110
pub points
52%
popularity

Publisher

imanol.dev

Package to make Geocode requests. It exposes two methods to translate coordinates into locations and addresses into coordinates.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

http

More

Packages that depend on geocode