Skip to content

To mercator and to wgs84 function #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Newmanjack
Copy link

Created Two Main Functions:

Based this branch off original omercator and oWsg co-ordinate function

geoToMercator(): Transforms WGS84 coordinates to Web Mercator projection
geoToWgs84(): Converts Web Mercator coordinates back to WGS84
Implemented in Clean, Distinct Files:

lib/src/to_mercator.dart: Contains WGS84→Mercator transformation logic
lib/src/to_wgs84.dart: Contains Mercator→WGS84 transformation logic
Updated lib/transform.dart to export both functions
Full GeoJSON Support:

Both functions handle all standard GeoJSON types
Support for Position, Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon
Complete handling of Feature and FeatureCollection objects
Preservation of properties and metadata
Key Features:

Accurate mathematical transformations based on spherical Mercator formulas
Altitude preservation throughout transformations
mutate parameter for performance optimization
Comprehensive error handling and input validation
Robust type safety with appropriate casting
Testing:

Created dedicated test files for each transformation direction
Tests cover all supported GeoJSON object types
Verified round-trip accuracy
All tests passing successfully
Usage Examples:

Created example files demonstrating real-world usage
Included examples for different GeoJSON types
Demonstrated round-trip conversion accuracy

- Update documentation to use proper Dart doc syntax with types in []
- Convert var to final where appropriate
- Maintain consistent documentation style across the codebase
- Improve readability of function parameter documentation
- Removed lib/src/point_on_feature.dart
- Removed lib/point_on_feature.dart
- Removed benchmark/point_on_feature_benchmark.dart
- Removed test/components/point_on_feature_test.dart

These files are now part of the point_on_feature_final branch and pull request
- Updated convertCoordinates, toMercator, and toWGS84 functions to use Position type instead of List
- Added proper altitude preservation during coordinate conversions
- Improved error handling with ArgumentError and descriptive messages
- Added tests to verify conversions and altitude preservation
- Updated Progress.md to mark functions as implemented
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant