Skip to content

Instantly share code, notes, and snippets.

View vs-krasnov's full-sized avatar

Vsevolod Krasnov vs-krasnov

  • Supernova.io
  • Hamburg, Germany
View GitHub Profile
@vs-krasnov
vs-krasnov / geo.kt
Created November 25, 2018 17:14
Simple function to calculate a new point's latitude and longitude based on provided start point, bearing and distance.
fun getPointByDistanceAndBearing(lat: Double, lon: Double, bearing: Double, distanceKm: Double): Pair<Double, Double> {
val earthRadius = 6378.1
val bearingR = Math.toRadians(bearing)
val latR = Math.toRadians(lat)
val lonR = Math.toRadians(lon)
val distanceToRadius = distanceKm / earthRadius
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {