-
-
Notifications
You must be signed in to change notification settings - Fork 871
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
[BUG] More LatLngBounds issues in polar CRS #1391
Comments
How many resolutions do you have for the crs ? It sounds a bit like there aren't enough for the available zoom levels, but I may well be talking out of my *** as my crs foo is very weak (I also thought there was a hacky fix to avoid that, so what I'm saying may well be a redherring and meaningless :D)! This is more looking at the exception rather than accuracy issues. What version is this on ? |
Using the I think the issue is twofold:
final swPoint = project(bounds.southWest!, zoom);
final nePoint = project(bounds.northEast!, zoom);
final center = unproject((swPoint + nePoint) / 2 + paddingOffset, zoom); As evident in #1347, |
Ok, so I guess the exception problem is that fitBounds doesn't have any width/height, as its just a single point, so it hits infinity, and I guess the same issue will still happen if its a very narrow range that falls outside of available the resolutions ? Maybe the Proj4Crs in crs.dart should handle that a bit more elegantly... |
By default ( Larger polylines for example also experience the out of bounds error, but I suppose that could also be because the EDIT: One use-case for using single-point bounds is to center as closely as possible on a marker. My layers all expose their |
Just thinking out loud. I suspect this may get hit before maxZoom gets checked, as fitbounds needs to calculate the zoom (and hit the error) first I assume before it can test against maxZoom ? But I'm a little unclear about whats desired here...if people want to focus on a point, shouldn't they be using a center and not fitBounds ? (mm maybe not as you may have a very small poly, but leaving this here anyway). |
That would complicate the code a bit, but it's also possible. I have polylines which change dynamically over time. If you have a polyline which can be 0-n points, you have to consider:
If |
You are right, I found I only get out of bounds issues with singular bounds. Perhaps supporting singular bounds would make the API more confusing (although we might benefit from adding an assertion or such for clarity). I don't know, I don't feel very strongly about it. In my fork I have now removed the |
I have some vague thoughts around it, just not had time really lately. I.e in the crs code we have..
what about if we had before the interpolate, something like...(code not tested/checked, just as a theory) What would happen here...it feels reasonable if we have a set limit of resolutions, not to go over them, but return the closest thing ? |
What is the bug?
In line with #1347 and #1295, there are more issues with bounds for polar CRS.
In some cases
fitBounds
(and my copyflyToBounds
) throws an error:... and when it doesn't throw an error, it gets completely incorrect coordinates. In part, this has to do with the fact that corner coordinates are not necessarily the bounds in a polar CRS. Especially dealing with longitudes is difficult. With either of the poles on the map for example, you have all longitudes possible in the pole, a single point.
There could potentially also be issues in the tile layer, which is using a similar approach for bounds checks, but I haven't encountered those issues personally.
What is the expected behaviour?
That
fitBounds
would work the same way regardless of CRS.How can we reproduce this issue?
Try
fitBounds
in the EPSG:3413 example'sinitState
(addmapController
as class variable).Incorrect position (should center on overlay image):
Out of bounds:
Do you have a potential solution?
No response
Can you provide any other information?
Using the
master
version offlutter_map
, but also present in older versions.Platforms Affected
Android, iOS, Web, Windows, MacOS, Linux
Severity
Erroneous: Prevents normal functioning and causes errors in the console
Frequency
Consistently: Always occurs at the same time and location
Requirements
flutter doctor
finds no relevant issuesThe text was updated successfully, but these errors were encountered: