nova_geocoder 1.1.0 copy "nova_geocoder: ^1.1.0" to clipboard
nova_geocoder: ^1.1.0 copied to clipboard

A package to transform a description of a location i.e. street address, town name into latitude and longitude and vice versa.

Nova Geocoder Pub #

A package to transform a description of a location i.e. street address, town name into latitude and longitude and vice versa.

This package uses Google Maps Geocoding API and requires an API key. Please check this link out to obtain your API key.

🍭 Remember to enable Geocoding API for your API key.

Sample Usage #

import 'package:nova_geocoder/nova_geocoder.dart';

final geocoder = Geocoder('api-key')
  ..setLanguage('en')
  ..setRegion('us');

final response1 = await geocoder.fromLatLng(37.773972, -122.431297);
if (!response1.isSuccess) {
  print('Response 1 error: ${response1.errorMessage}\n');
} else {
  print('Response 1 \n');
  final location = response1.results.first;
  print(location.geometry.location);
  print(location.geometry.bounds);
  print(location.geometry.viewport);
  print(location.formattedAddress);
}

final response2 = await geocoder.fromAddress('Golden Gate Heights');
if (!response2.isSuccess) {
  print('Response 2 error: ${response2.errorMessage}\n');
} else {
  print('Response 2 \n');
  final location = response2.results.first;
  print(location.geometry.location);
  print(location.geometry.bounds);
  print(location.geometry.viewport);
  print(location.formattedAddress);

  final simpleAddress = location.getSimpleAddress();
  print(simpleAddress.location);
  print(simpleAddress.city);
  print(simpleAddress.country);
}
2
likes
0
pub points
54%
popularity

Publisher

unverified uploader

A package to transform a description of a location i.e. street address, town name into latitude and longitude and vice versa.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http, logging

More

Packages that depend on nova_geocoder