Skip to content

regular results when distance values are the exact same #44

@mapsam

Description

@mapsam

The following test asserts that result order remains the same when distances are the same value

test('results with same exact distance return in expected order', assert => {
  // this query returns four results, three of which are the exact same distance and different types of features
  const buffer = fs.readFileSync(path.resolve(__dirname+'/../node_modules/@mapbox/mvt-fixtures/real-world/chicago/13-2098-3045.mvt'));
  const ll = [-87.7964, 41.8675];
  vtquery([{buffer: buffer, z: 13, x: 2098, y: 3045}], ll, { radius: 10, layers: ['road'] }, function(err, result) {
    assert.equal(result.features[1].properties.type, 'turning_circle', 'is expected type');
    assert.ok(checkClose(result.features[1].properties.tilequery.distance, 9.436356889343624, 1e-6), 'is the proper distance');
    assert.equal(result.features[2].properties.type, 'service:driveway', 'is expected type');
    assert.ok(checkClose(result.features[2].properties.tilequery.distance, 9.436356889343624, 1e-6), 'is the proper distance');
    assert.equal(result.features[3].properties.type, 'pedestrian', 'is expected type');
    assert.ok(checkClose(result.features[3].properties.tilequery.distance, 9.436356889343624, 1e-6), 'is the proper distance');
    assert.end();
  });
});

This works on OSX, but fails on linux with a different order of values. Let's figure out how priority_queues are handled differently between the two OS's and then this test can be added back in. Plenty of background on this ticket in #42, including a Dockerfile to recreate the failing test.

Note: I've tried updating the CompareDistance operator to use <= with no luck.

cc @flippmoke @springmeyer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions