GithubHelp home page GithubHelp logo

wingkwong / geodesy Goto Github PK

View Code? Open in Web Editor NEW
51.0 4.0 11.0 114 KB

A Dart library for geodesic and trigonometric calculations working with points and paths

Home Page: https://pub.dartlang.org/packages/geodesy

License: MIT License

Dart 100.00%
dart geodesy geography geometry distance distance-calculation coordinate geodetic-point geodesy-functions trigonometric-calculation

geodesy's Introduction

Geodesy

pub package

About

A Dart library for implementing geodesic and trigonometric calculations based on a spherical Earth model for working with points and paths such as distances, bearings and destinations.

How to Use Geodesy

Commands

For Dart

dart pub add geodesy

For Flutter

flutter pub add geodesy

Import Geodesy

import 'package:geodesy/geodesy.dart';

Class

The Geodesy class provides a collection of methods for performing various geodetic calculations, including distance calculations, point intersections, and more. This class is designed to work with geographical coordinates in the form of latitude and longitude.

Please see the Usage and Example.

Static Methods

Static methods are available without using Geodesy instance.

Please see the Usage and Example.

License

This project is licensed under MIT.

Contributors

Thank you for your contributions! We appreciate all the contributions from the community.

geodesy's People

Contributors

ayoubzulfiqar avatar bsneider avatar renovate[bot] avatar synw avatar wingkwong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

geodesy's Issues

Polygon envelope

Yet another feature request: I would like to be able to get a rectangular polygon that contains a given polygon: similar to the envelope method of GeoPandas.

This is to fit a map boundaries around a polygon, to center on a polygon. Code could be something like:

List<LatLng> rectangleBounds = geoEnvelope(<LatLng>[
  // coords
]);

error in calculatePolygonArea unit

In my cartographic app I have a tool to measure a distance and a surface with user selected points.
I've used Geoportail to check if measurment is correct (just measuring the same thing in my app and the website).
While distance using distanceBetweenTwoGeoPoints seems correct, area using calculatePolygonArea looks quite wrong.
When Geoportail says 0.116km², distanceBetweenTwoGeoPoints returns 0.00001370770505371155 m², which is not at all the same.
After a quick look at the code, maybe there is a unit mismatch ? You are summing & multiplying lat & lng values directly, which are not meters, and returning directly that value in supposely m².
Something looks wrong ?

EDIT : when looking at some other algo, they look very different, using more advanced math trigonometry ?
https://github.com/dartclub/turf_dart/blob/bbccfb3cebb532a2e8341294f30590ae8a541b5d/lib/src/area.dart#L74
https://github.com/divvitco/geodart/blob/be4016f1b74baf5dcf54fef7ce5e3ed00028ba0b/lib/src/featureTypes/geometries/linear_ring.dart#L43
https://github.com/kb0/maps_toolkit/blob/540da77cf12d2a1dfceb12183776fb4969020750/lib/src/spherical_util.dart#L186

EDIT: I've compared using computeArea of maps_toolkit, it work as expected.

Geopoint in polygon

Hi. I have seen there is a isGeoPointInBoudingBox function. I'm looking for a way to tell if a geopoint is in a given polygon.

Would a isGeoPointInPolygon function be doable?

Polygons intersection

Any idea howa to get the intesection between the blue polygon and the grey one ? Thanks

CCA41664-2EC3-465E-95BB-982826A304D0

Use the LatLong package?

Hi, would it be possible to use the LatLong(https://pub.dartlang.org/packages/latlong) package for standard coordinates data structure? It looks pretty solid (it enforces 90/-90 degrees constrains for latitude and longitude for example) and standard (it is used in great packages like Flutter map).

It could reduce duplicated maintenance work. Your module covers a much more broader scope it could makes sense to use it. And also to provide a standard data format across packages: example: I have a list of these coordinates and want to pass it to isGeoPointInPolygon: for now I have to convert it to use your class, which has an unpleasant cost.

Polygon centroid

Hi, I'm looking for a way to find the centroid of a polygon. I've seen the midPointBetweenTwoGeoPoints function. It would be useful to have a polygonCentroid function to have the center between multiple points.

{Edit]: rephrased for clarity

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

pub
pubspec.yaml
  • latlong2 ^0.9.0
  • lints ^4.0.0
  • test ^1.16.8
  • dart >=3.0.0 <4.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Null Safety Upgrade

upgrade to be null safe. Switch from deprecated LatLong to LatLong2 package which is a forked null safe version that is not deprecated. Run dart migrate, update tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.