geocoder_offline 0.1.2

  • Readme
  • Changelog
  • Installing
  • 68

Offline Geocoder #

Dart library for super-fast offline reverse geocoding. Package use k-d tree for a search of the nearest location in a given file. One when Geocoder is initialized, search for location is super-fast, about 4-5 milliseconds.

Data #

For using the reverse geocoding library you need to provide а file with data about places among you want to run reverse geocoding. In examples you can see how to use а library with two example files:

  1. GeoNames data file with all world cities with a population above 15 000
  2. USGS data file with USA cities with a population above 5000.

Library allows you to use any other file who has at least data about name, latitude, and longitude of places you want to search.

Usage #

Import #

import 'package:geocoder_offline/geocoder_offline.dart';

Initialization #

var geocoder = GeocodeData(
    File('/example/NationalFedCodes_20191101.csv').readAsStringSync(), //input string
    'FEATURE_NAME', // place name header
    'STATE_ALPHA', // state/countery header
    'PRIMARY_LATITUDE', // latitute header
    'PRIMARY_LONGITUDE', // longitude header
    fieldDelimiter: ',', // fields delimiter
    eol: '\n');

Reverse geocoding #

List<LocationResult> result = geocoder.search(41.881832, -87.623177);

Features and bugs #

If you any problem using library or you have any new needs, please file feature requests and bugs at the issue tracker.

0.1.2 #

  • Add new examples

0.1.1 #

  • Fixed bearing calculation

0.1.0 #

  • Initial version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  geocoder_offline: ^0.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:geocoder_offline/geocoder_offline.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
46
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
79
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on Jan 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health issues and suggestions

Document public APIs. (-1 points)

46 out of 46 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/src/LocationData.dart.

Run dartfmt to format lib/src/LocationData.dart.

Format lib/src/LocationResult.dart.

Run dartfmt to format lib/src/LocationResult.dart.

Format lib/src/geocoder_offline_base.dart.

Run dartfmt to format lib/src/geocoder_offline_base.dart.

Maintenance suggestions

The package description is too short. (-11 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and geocoder_offline.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
csv ^4.0.3 4.0.3
kdtree ^0.0.2 0.0.2
Dev dependencies
pedantic ^1.8.0
test ^1.6.0