Closed stefan2718 closed 5 years ago
Excellent idea! I like it.
Perhaps from_ll_to_subpixel
would be a good name?
[EDIT]: PR is very welcome. :heart:
Version 1.2.0 is now released on Crates.io. Thank you for your contribution!
Thanks for your responsiveness and quick release time!
In the
from_ll_to_pixel
function, the returned values are rounded:This differs from the functionality of the Google Maps API function
OverlayView.getProjection().fromLatLngToDivPixel()
which returns fractional pixel values. All browsers accept fractional pixel values (but will usually round them when rendering).The purpose of non-rounding (as you might figure out from the screenshot) would be to increase accuracy. For example, I am extending a pixel-based area around a coord or bounds, then converting back to coords, so I can calculate if coordinates are in pixel-based bounds near other coordinates.
In order to prevent breaking changes, I would recommend creating a new function
from_ll_to_pixel_no_rounding
(or something similar) that contains the calculations without rounding. Then the originalfrom_ll_to_pixel
can call this new function and return the rounded results.If you think this is a reasonable feature to add, I'd be willing to put together the PR. Let me know, thanks!