-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Geometry.Point
Equals returns true when Lat/Long on both points are null.
#149
Comments
@morehavoc once again the rub comes down to the razor component rendering support. Without an equality check, it is possible for the rendering cycle to continue adding the same graphic to the layer or view, since we are manually registering everything. It is possible that this is no longer an issue given other changes, but that would be my main concern to test, that removing equality checks does not create many duplicates in markup-rendered graphics. As far as just updating the equality check, I'm 100% for this. Would it work to just do |
@morehavoc I'm revisiting this open gissue. It doesn't seem to be impacting users much, however, I would like to resolve it. Based on the doc link you shared above, I think we could do equality checks only on X/Y, and skip Lat/Long, since they are either |
@TimPurdum For point geometries, I think we might have to check all of them: Lat, Long, X, Y, Z, M. I think, based on your descriptions of how we have to keep track of things between renders, that we could have points that are Lat, Long, but no other properties, so I think we have to check all 6 values to ensure they are the same (they can be null, as long as they are null in both points). For other geometries, we should check each point in the list to verify that each one is the same, and that each point needs to be compared on all of its properties (which I think are X, Y, Z, M at most). |
@morehavoc I've been doing more digging, and you were correct. I fixed the re-rendering issue that is at the root of GeoBlazor awhile ago, and I am in the process of testing removing all the equality checks. |
TL;DR
I think we need to do four things:
&&
instead of||
between the lat/long and x/y/z comparisons. But also, what about M values?id
(We should discuss this, perhaps it should just include more, for example, a Graphic could be the same geometry and same attributes but a different symbol, those would be two different graphics.)And now the rest of the story
I discovered this while adding points to graphics layers. It turns out that GeoBlazor checks to see if the graphic has already been added... I don't think we should do this check. It seems strange to add the same graphic multiple times.. but I can see it as a workflow. Maybe I need to throw them on the map and then be able to do a count when the user clicks? So.. I think we should remove that, or if we need it, only check the ID. It's also a little expensive if I have lots of graphics!
But back to the problem at hand. When comparing two graphics, it checks the
Geometry
and these two points are coming back astrue
(Equal).Point 1:
Point 2:
These two points are not the same. However, they do both have the same Lat/Long values... null.
If I understand this function correctly:
Then
Latitude.Equals(other.Latitude)
when both Latitude's are null will be true. This proves to be true in an immediate window as well:The docs for Lat and Long properties in Javascript say:
In my case, I am using geometries that I have done things to, projected, densified, etc. and the Lat/long values are not populated. So, we need to sort out when lat/long should participate in the equality test, if ever.
The text was updated successfully, but these errors were encountered: