1

For example, I have 2 points and I want to know if they intersect. If yes, I need to delete first points. Should I use OpenLayers .intersects method? Because it greatly depends on zoom level.

Or should I use distanceTo method?

Or how should I do control intersections?

2
  • why not just compare their coordinates x , y ?
    – geogeek
    Commented Apr 9, 2013 at 18:22
  • For example, I have OpenLayers.Geometry.Point(0,45) and OpenLayers.Geometry.Point(0,46).Their geometries are not the same, but if zoom level is quite big, user sees that features are intersecting. Ofc it also depends on strokeWidth parameter.
    – Dmitri
    Commented Apr 9, 2013 at 18:27

1 Answer 1

1

This issue deals with an important point when it comes to GIS data: Spatial Resolution & Precision.

You have said in the comment that that a point (0, 45) & (0, 46) might appear to be on the same location given a low enough zoom level. How do you tackle this? Do you want the tolerance value to change depending on the Zoom level? Or do you want it to be fixed? Say that two points are coincident, if they lie within 2 m of each other?

In either case, you will need the distance measurement.

For Points it doesn't make sense to use exact point coincidence or intersection, since that is pretty much useless due to floating point precession used in computer systems.On a related note, Every Computer Scientist Should Know About Floating-Point Arithmetic

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.