google_maps_utils 3.0.0
google_maps_utils: ^3.0.0 copied to clipboard
SphericalUtils, MathUtils and PolyUtils ported from Google's android-maps-utils: distances, headings, bounds, polyline encode/decode and Douglas-Peucker simplification.
Changelog #
3.0.0 #
- BREAKING: the public API is now typed with
doubleinstead ofnum. Coordinates usePoint<double>(so methods takePoint<double>/List<Point<double>>and scalar parameters likedistance,heading,tolerance,fractionandradiusaredouble); all numeric return types are nowdouble(orintfor indices). Callers usingList<Point>,Point<num>or integer-coordinate points must switch toPoint<double>(e.g.Point(0.0, 0.0)). Behaviour and results are unchanged. - Fixed
PolyUtils.isLocationOnEdge,isLocationOnPathandlocationIndexOnPath/locationIndexOnEdgeOrPathalways reporting "not on path" in geodesic mode (even for a point lying exactly on the line). Three boolean returns in the private_isOnSegmentGChelper were inverted during the original Java port; they now match the canonicalandroid-maps-utilssource. - Fixed & upgraded
PolyUtils.containsLocationPoly. It returned wrong results on shapes with multiple vertices when the test point shared a latitude with a vertex (issue #11). It is now a faithful spherical port of android-maps-utils'PolyUtil.containsLocation(verified identical in v2.3.0 and v4.5.1), so it is also correct for polygons that cross the antimeridian (±180°) or enclose a pole — cases the old planar ray-cast could not handle. Added an optionalgeodesicparameter (great-circle vs Rhumb edges; defaults tofalse, the closest match to prior behaviour). Verified against an independent 3D winding-number oracle across 200k points. A point on a vertex is inside; the result for a point exactly on an edge is now undefined (it was a fragile, float-exact check before). - Performance:
PolyUtils.decodeno longer re-splits the entire encoded string on every character (O(n²) → O(n));encodeinternals simplified. Output is unchanged. - Docs: corrected stale
DistanceandDistance to Linevalues in the README and example (they predated theearthRadiusprecision update) and fixed a malformed code fence. - Tests: added regression tests for the geodesic on-path/on-edge bug plus broad coverage for previously-untested functions.
- Pub score: resolved all
package:lints/coreanalysis issues (return-type and dangling-doc-comment lints), eliminated every dartdoc warning, documented the remaining public members, and addedanalysis_options.yaml, alintsdev-dependency, arepositoryfield and a refreshed package description. - Style: local variables now use
final name = …(inferred type) when never reassigned and an explicitType name = …(novar) when reassigned; enabledprefer_final_locals. - Funding: added a
funding:entry to the pubspec, a.github/FUNDING.yml, and a README sponsor section, all pointing to bus2.me.
Audited and fixed with Claude Opus 4.8 (Ultracode — xhigh + workflows). Sponsored by bus2.me
2.0.0+1 #
- Fixed
toSubBounds
2.0.0+0 #
- BREAKING CHANGE
- Changed folder files structure
- Replaced all
intanddoublebynum
- Added
toSubBounds
1.5.1+0 #
-
Fixed import directive
-
Updated
earthRadiusto more precise value
1.5.0+0 #
- Calculate route distance
1.4.0+1 #
- nnbd hotfix for pub.dev dartanalyzer
1.4.0 #
- nnbd migration
1.3.0+1 #
- dartfmt -w .
1.3.0 #
-
Added toBoundsFromPoints (Request by https://github.com/adam-ashored)
-
Added centerFromLatLngBounds
-
Fixed some docs
1.2.2+1 #
Fixed: 'List' is deprecated and shouldn't be used.
Updated poly stack package
1.2.2+0 #
Fixed changelog order for new releases, left unordered for old releases
Breaking changes:
-
Renamed LatLngBounds to GMULatLngBounds, prevent using prefix import while using google_maps_flutter
-
MathUtils, PolyUtils and SphericalUtils are no longer instantiable
1.2.1+1 #
Added all cardinal directions Removed PT-BR exclusive function translation from cardinals
1.2.1+0 #
Fixed Poly simplify, merge PR thanks to https://github.com/0oL
1.2.0+3 #
Replaced LatLng for Point class, kept LatLngBounds class
1.2.0+2 #
Fixed Readme
Added: https://pub.dev/packages/poly package for replacing Google's containsLocation function for compiler reasons, google java code could not behave as expected, replacing by new algorithm from Poly package fixed the issue, thanks https://github.com/nicolascav for the feedback.
Added https://github.com/nicolascav code as example on example.dart
1.2.0+1 #
1.0.0+1 #
Added SphericalUtils and MathUtils
1.0.0+2 #
Added Readme, License and PolyUtils
1.0.0+3 #
Simplified and shorted some codes Fixed Readme
1.1.0+1 #
Added Changelog and formated all files, updated stack package from ^0.0.1 to ^0.1.0 Removed google maps package, replaced for created Lightweight Point and LatLngBounds classes (lat_lng.dart) Fixed docs in all classes Added example.dart
1.1.0+2 #
Fixed description
1.1.0+3 #
Fixed description
1.1.1+0 #
Fixed poly_utils.dart, all 3 functions are working as expected Removed unnecessary dependencies Updated example.dart Added example.dart in Readme
1.1.1+1 #
1.1.1+2 #
1.1.1+3 #
Fixed dart.pub health: DO use curly braces for all flow control structures
1.1.1+4 #
Fixed LatLngBounds variable names Fixed toBounds method, variables in return were inverted