Skip to content

booleanCrosses not working as expected #1901

@dclipca

Description

@dclipca

As per title, booleanCrosses does not work as expected. In this example, I provide two LineStrings that should intersect a LineString (as illustrated in the representation of the coordinates in the images attached below) but booleanCrosses return false.

    let line1 = {
        "type": "Feature",
        "properties": {},
        "geometry": {
            "type": "LineString",
            "coordinates": [
                [-70.63436881703247, 42.68738824218277],
                [-70.65233503703247, 42.68738824218277]
            ]
        }
    }

    let line2 = {
        "type": "Feature",
        "properties": {},
        "geometry": {
            "type": "LineString",
            "coordinates": [
                [-70.64335192703247, 42.69637135218277],
                [-70.64335192703247, 42.67840513218277]
            ]
        }
    }

    let coast = {

                  "type": "Feature",
                  "properties": {
                      "@id": "way/81606181",
                      "natural": "coastline",
                      "source": "Bing"
                  },
                  "geometry": {
                      "type": "LineString",
                      "coordinates": [
                          [-70.6433177, 42.6868265],
                          [-70.6432566, 42.6868154],
                          [-70.6431987, 42.6868074],
                          [-70.6431823, 42.686827],
                          [-70.6431638, 42.686834],
                          [-70.6431554, 42.6868565],
                          [-70.6431197, 42.6868921],
                          [-70.6430858, 42.6869429],
                          [-70.6430718, 42.6870095],
                          [-70.6430576, 42.6870561],
                          [-70.6430143, 42.6871279],
                          [-70.6429803, 42.6872049],
                          [-70.6429879, 42.6872361],
                          [-70.6430069, 42.687294],
                          [-70.6429886, 42.6873373],
                          [-70.6429655, 42.6873761],
                          [-70.6429517, 42.6874289],
                          [-70.6429176, 42.6874653],
                          [-70.6430169, 42.6874724],
                          [-70.6430173, 42.6875046],
                          [-70.6429568, 42.6875301],
                          [-70.6429351, 42.6875707],
                          [-70.6429639, 42.6876026],
                          [-70.6429618, 42.6876273],
                          [-70.6429205, 42.6876437],
                          [-70.642979, 42.6876995],
                          [-70.643058, 42.6876823],
                          [-70.6431052, 42.6876416],
                          [-70.6431347, 42.6876132],
                          [-70.6431633, 42.6875763],
                          [-70.6432075, 42.6875091],
                          [-70.6432276, 42.6875191],
                          [-70.643243, 42.6875865],
                          [-70.6432592, 42.6876215],
                          [-70.6432361, 42.6876818],
                          [-70.6432436, 42.6877306],
                          [-70.6432404, 42.6877815],
                          [-70.6432299, 42.6878144],
                          [-70.6432724, 42.687847],
                          [-70.6433394, 42.6878478],
                          [-70.6433343, 42.6879072],
                          [-70.6433207, 42.6879654],
                          [-70.6433571, 42.6880021],
                          [-70.643407, 42.6880716],
                          [-70.6434145, 42.6881248],
                          [-70.6434053, 42.6882038],
                          [-70.6433689, 42.688232],
                          [-70.6433801, 42.6882777],
                          [-70.6434366, 42.6882993],
                          [-70.6434638, 42.6883448],
                          [-70.6435474, 42.6883564],
                          [-70.6436326, 42.6883874],
                          [-70.6436274, 42.6884498],
                          [-70.6436621, 42.6884967],
                          [-70.6436683, 42.6885168]
                      ]
                  }
                }

    console.log(booleanCrosses(line1, coast), booleanCrosses(line2, coast)) // false, false

Version: "@turf/turf": "^5.1.6"

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions