पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv3.0.2

gmaps_by_road_distance_calculator

यह एक पैकेज है जो मानचित्र में एक बिंदु से दूसरे बिंदु तक रोड दूरी की गणना करता है।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
135
लाइक
14
Pub अंक
120

पैकेज इंस्टॉल करें

flutter pub add gmaps_by_road_distance_calculator

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

यह Flutter पैकेज Google Maps डेटा का उपयोग करके दो भौगोलिक बिंदुओं के बीच सड़क-आधारित दूरी की गणना करता है। यह वास्तविक दुनिया के सड़क नेटवर्क का उपयोग करके सटीक यात्रा दूरी और मार्ग अनुमान लगाने में सक्षम बनाता है, जिससे यह नेविगेशन और लॉजिस्टिक्स एप्लिकेशन के लिए आदर्श है। इस पैकेज का समर्थन एंड्रॉइड, आईओएस, वेब, मैकओएस, विंडोज और लिनक्स जैसे कई प्लेटफॉर्म के लिए है, जिससे व्यापक संगतता सुनिश्चित होती है। डेवलपर्स इसे एक सरल कमांड-लाइन जोड़ के माध्यम से आसानी से एकीकृत कर सकते हैं। यह ऐसे उपयोग केस के लिए डिज़ाइन किया गया है जिसमें वास्तविक सड़क मार्गों के आधार पर सटीक, रियल-टाइम दूरी की गणना की आवश्यकता होती है, न कि सीधी रेखा (जैसे कि चिड़िया) मापने के आधार पर।

उपयोग

  • नेविगेशन ऐप्स
  • लॉजिस्टिक्स और डिलीवरी ट्रैकिंग
  • मार्ग योजना उपकरण
  • यात्रा समय अनुमान
  • नक्शों में दूरी-आधारित फ़िल्टरिंग

मुख्य विशेषताएँ

  • सड़क दूरी की गणना
  • बहु-प्लेटफॉर्म समर्थन
  • Google मानचित्र एकीकरण
  • सरल API इंटरफ़ेस
  • रियल-टाइम दूरी अपडेट

इनके लिए उपयुक्त

  • नेविगेशन फीचर्स बना रहे डेवलपर्स
  • सटीक यात्रा दूरी की आवश्यकता वाले ऐप्स
  • प्लेटफॉर्म के अनुसार मानचित्र एप्लिकेशन
  • डिलीवरी और राइड-शेयरिंग सेवाएं
  • स्थान-जागरूक विश्लेषण

विचार योग्य बातें

  • API कॉल के लिए इंटरनेट कनेक्शन की आवश्यकता होती है
  • Google Maps बैकएंड उपलब्धता पर निर्भर करता है
  • उच्च अनुरोध आवश्यकता के साथ उपयोग लागत हो सकती है
  • गूगल मानचित्र द्वारा प्रदान की गई सड़क नेटवर्क डेटा तक सीमित

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

gmaps_by_road_distance_calculator

A Dart package for calculating distances along roads and routes using multiple APIs and formats.

Features

  • Calculate distances between geographical points
  • Support for real-time distance tracking
  • Calculate distances along roads using OSRM (Open Source Routing Machine)
  • Multiple travel modes: driving, bicycling, walking, transit
  • Parse and work with GPX and KML route files
  • Decode polyline strings to geographical points

Getting Started

Installation

Add the package to your pubspec.yaml:

dependencies:
  gmaps_by_road_distance_calculator: ^1.0.0

Then run:

flutter pub get
Import
import 'package:gmaps_by_road_distance_calculator/gmaps_by_road_distance_calculator.dart';

Usage

Basic Distance Calculation

Calculate straight-line distances between geographical points:

final calculator = ByRoadDistanceCalculator();
final points = [
  LatLng(37.7749, -122.4194), // San Francisco
  LatLng(34.0522, -118.2437), // Los Angeles
];

// Calculate straight-line distance in kilometers
final distance = calculator.calculateDistance(points);
print('Distance: $distance km');
Calculate Road Distance Using OSRM

Calculate actual road distance between two points using the OSRM service:

final calculator = ByRoadDistanceCalculator();
final start = LatLng(37.7749, -122.4194); // San Francisco
final end = LatLng(34.0522, -118.2437); // Los Angeles

// Calculate driving distance
calculator.calculateDistanceViaOSRM(
  start: start,
  end: end,
  mode: TravelModes.driving,
).then((result) {
  print('Driving distance: ${result.distance} km');
  print('Route consists of ${result.points.length} points');
});

// Calculate walking distance
calculator.calculateDistanceViaOSRM(
  start: start,
  end: end,
  mode: TravelModes.walking,
).then((result) {
  print('Walking distance: ${result.distance} km');
});
Real-time Distance Tracking

Track and update distance in real-time as new points are added:

final calculator = ByRoadDistanceCalculator();

// Listen for distance updates
calculator.distanceUpdates.listen((distance) {
  print('Current distance: $distance km');
});

// Add points as they become available (e.g., from GPS)
calculator.addPoint(LatLng(37.7749, -122.4194));
calculator.addPoint(LatLng(37.7850, -122.4100));
calculator.addPoint(LatLng(37.7950, -122.4000));

// Reset tracking when needed
calculator.clearPoints();
Working with GPX Files

Parse GPX files to extract geographical points:

final calculator = ByRoadDistanceCalculator();
final gpxContent = '''
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1">
  <trk>
    <trkseg>
      <trkpt lat="37.7749" lon="-122.4194"></trkpt>
      <trkpt lat="37.7850" lon="-122.4100"></trkpt>
      <trkpt lat="37.7950" lon="-122.4000"></trkpt>
    </trkseg>
  </trk>
</gpx>
''';

final points = calculator.parseGPX(gpxContent);
final distance = calculator.calculateDistance(points);
print('Distance from GPX: $distance km');
Working with KML Files

Parse KML files to extract geographical points:

final calculator = ByRoadDistanceCalculator();
final kmlContent = '''
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <Placemark>
      <LineString>
        <coordinates>
          -122.4194,37.7749,0
          -122.4100,37.7850,0
          -122.4000,37.7950,0
        </coordinates>
      </LineString>
    </Placemark>
  </Document>
</kml>
''';

final points = calculator.parseKML(kmlContent);
final distance = calculator.calculateDistance(points);
print('Distance from KML: $distance km');
Decode Polyline Strings

Convert encoded polyline strings to geographical points:

final encodedPolyline = "_p~iF~ps|U_ulLnnqC_mqNvxq`@";
final points = ByRoadDistanceCalculator.decodePolylineString(encodedPolyline);

Advanced Configuration

Custom OSRM Server

You can specify a custom OSRM server URL if you're hosting your own instance:

calculator.calculateDistanceViaOSRM(
  start: start,
  end: end,
  mode: TravelModes.driving,
  customOSRMUrl: 'https://your-custom-osrm-server.com/route/v1',
).then((result) {
  print('Distance: ${result.distance} km');
});

Dependencies

This package depends on:

  • latlong2: For geographical coordinate operations
  • http: For API requests
  • xml: For parsing GPX and KML files

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues and Feedback

Please file issues and feedback here.

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 4 आइटम

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट

अभी कोई डेटा उपलब्ध नहीं है।