Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ matrix:
before_script:
- export LD_PRELOAD=${MASON_LLVM_RT_PRELOAD}
- export ASAN_OPTIONS=fast_unwind_on_malloc=0:${ASAN_OPTIONS}
- export LSAN_OPTIONS=verbosity=1:log_threads=1
- npm test
- unset LD_PRELOAD
# after successful tests, publish binaries if specified in commit message
Expand Down
19 changes: 5 additions & 14 deletions src/vtquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,39 +227,30 @@ struct Worker : Nan::AsyncWorker {
mapbox::geometry::point<std::int64_t> query_point = utils::create_query_point(data.longitude, data.latitude, data.zoom, extent, tile_obj.x, tile_obj.y);
GeomType original_geometry_type = GeomType::unknown; // set to unknown but this will get overwritten
while (auto feature = layer.next_feature()) {
mapbox::geometry::geometry<std::int64_t> query_geometry = mapbox::geometry::point<std::int64_t>();
switch (feature.geometry_type()) {
case vtzero::GeomType::POINT: {
if (data.geometry_filter_type != GeomType::all && data.geometry_filter_type != GeomType::point) {
continue;
}
original_geometry_type = GeomType::point;
query_geometry = mapbox::vector_tile::extract_geometry<int64_t>(feature);
break;
}
case vtzero::GeomType::LINESTRING: {
if (data.geometry_filter_type != GeomType::all && data.geometry_filter_type != GeomType::linestring) {
continue;
}
original_geometry_type = GeomType::linestring;
query_geometry = mapbox::vector_tile::extract_geometry<int64_t>(feature);
break;
}
case vtzero::GeomType::POLYGON: {
if (data.geometry_filter_type != GeomType::all && data.geometry_filter_type != GeomType::polygon) {
continue;
}
original_geometry_type = GeomType::polygon;
query_geometry = mapbox::vector_tile::extract_geometry<int64_t>(feature);
break;
}
default: {
continue;
}
}

if (data.geometry_filter_type != GeomType::all && data.geometry_filter_type != original_geometry_type) {
continue;
}

// implement closest point algorithm on query geometry and the query point
auto const cp_info = mapbox::geometry::algorithms::closest_point(query_geometry, query_point);
auto const cp_info = mapbox::geometry::algorithms::closest_point(mapbox::vector_tile::extract_geometry<int64_t>(feature), query_point);

// check if cp_info.distance isn't less than zero, if so, this is an error and we can move on
if (cp_info.distance < 0.0) {
Expand Down