搜尋套件、儲存庫與 APP 分類

套件詳情v0.6.1

latlong

用於常見緯度和經度計算的輕量級程式庫

近 30 天下載
2300
喜歡數
116
Pub 分數
10

安裝套件

flutter pub add latlong

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個輕量級的 Dart 庫,專為高效地進行緯度和經度計算而設計。它提供基本的地物空間操作,例如距離計算、中點確定和座標轉換。非常適合需要基礎地理數學運算但又不希望引入重型依賴的應用程式。該套件容易整合,特別適合需要基於位置邏輯的行動與 Web 應用。它支援核心地理定位工具,開銷極小。

適用情境

  • 計算兩個坐標之間的距離
  • 查找位置之間的中點
  • 在坐標格式之間進行轉換
  • 實施基於位置的篩選
  • 構建導航輔助功能
  • 地理圍欄邏輯

主要特色

  • 最小佔用空間
  • 支援哈弗辛距離
  • 座標算術
  • 輕鬆整合
  • 無外部依賴
  • 跨平台相容性

適合對象

  • 具有位置功能的行動應用程式
  • Web 地圖工具
  • 簡單的地理空間計算
  • 原型定位邏輯
  • 需要輕量級地理定位工具的應用

使用建議

  • 僅限基本地理空間數學
  • 不支援地圖渲染
  • 不處理複雜投影
  • 不適合進階GIS任務
  • 無內建地理編碼
  • 需要手動處理邊緣情況

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

DEPRECATED


This package will not be maintained anymore!

The whole thing landed on TypeScript

Check out the lib on npmjs


LatLong provides a lightweight library for common latitude and longitude calculation.

This library supports both, the "Haversine" and the "Vincenty" algorithm.

"Haversine" is a bit faster but "Vincenty" is far more accurate!

LatLong

Catmull-Rom algorithm is used for smoothing out the path.

Basic usage

Distance
    final Distance distance = new Distance();
    
    // km = 423
    final int km = distance.as(LengthUnit.Kilometer,
     new LatLng(52.518611,13.408056),new LatLng(51.519475,7.46694444));
    
    // meter = 422591.551
    final int meter = distance(
        new LatLng(52.518611,13.408056),
        new LatLng(51.519475,7.46694444)
        );

Offset

    final Distance distance = const Distance();
    final num distanceInMeter = (EARTH_RADIUS * math.PI / 4).round();
    
    final p1 = new LatLng(0.0, 0.0);
    final p2 = distance.offset(p1, distanceInMeter, 180);
    
    // LatLng(latitude:-45.219848, longitude:0.0)
    print(p2.round());
    
    // 45° 13' 11.45" S, 0° 0' 0.00" O
    print(p2.toSexagesimal());
            

Path smoothing

    // zigzag is a list of coordinates
    final Path path = new Path.from(zigzag);
    
    // Result is below
    final Path steps = path.equalize(8,smoothPath: true);

Smooth path

Features and bugs

Please file feature requests and bugs at the issue tracker.

License

Copyright 2015 Michael Mitterer (office@mikemitterer.at),
IT-Consulting and Development Limited, Austrian Branch

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language
governing permissions and limitations under the License.

If this plugin is helpful for you - please (Circle) me or star this repo here on GitHub

所屬分類

依賴

依賴清單 4 項

  • console_log_handler>=1.1.0 <2.0.0
  • intl>=0.15.0 <1.0.0
  • logging>=0.11.3 <1.0.0
  • validate^1.0.0

原始碼儲存庫

使用此套件的專案