osm_shortlink 0.0.2 copy "osm_shortlink: ^0.0.2" to clipboard
osm_shortlink: ^0.0.2 copied to clipboard

A Dart implementation of the OpenStreetMap Shortlink algorithm for encoding and decoding coordinates and zoom levels.

example/main.dart

import 'package:osm_shortlink/osm_shortlink.dart';

void main() {
  // Berlin Brandenburg Gate
  const double lon = 13.3777;
  const double lat = 52.5163;
  const int zoom = 17;

  // Encode to shortlink
  final String code = OsmShortlink.encode(lon, lat, zoom);
  print('Location: $lat, $lon at zoom $zoom');
  print('Shortlink: https://osm.org/go/$code');

  // Decode back
  final ShortlinkLocation decoded = OsmShortlink.decode(code);
  print('Decoded: ${decoded.latitude}, ${decoded.longitude} at zoom ${decoded.zoom}');
}
0
likes
160
points
86
downloads

Documentation

API reference

Publisher

verified publishervishna.dev

Weekly Downloads

A Dart implementation of the OpenStreetMap Shortlink algorithm for encoding and decoding coordinates and zoom levels.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

meta

More

Packages that depend on osm_shortlink