Conversation
| v8::Local<v8::Object> tilequery_properties_obj = Nan::New<v8::Object>(); | ||
| for (auto const& prop : feature->properties) { | ||
| properties_obj->Set(Nan::New<v8::String>(prop.first).ToLocalChecked(), get_property_value(prop.second)); | ||
| set_property(prop, properties_obj); |
There was a problem hiding this comment.
@flippmoke this loop never ... loops. Am I referencing feature->properties correctly?
| v8::Local<v8::Object> tilequery_properties_obj = Nan::New<v8::Object>(); | ||
| tilequery_properties_obj->Set(Nan::New("distance").ToLocalChecked(), Nan::New<v8::Number>(feature->distance)); | ||
| std::string og_geom = getGeomTypeString(feature->original_geometry_type); | ||
| tilequery_properties_obj->Set(Nan::New("geometry").ToLocalChecked(), Nan::New<v8::String>(og_geom).ToLocalChecked()); |
There was a problem hiding this comment.
@flippmoke The original geometry type string shows up in the final GeoJSON, but layer_name doesn't (one line lower). Not sure why.
|
This is currently blocked by mapbox/spatial-algorithms#21 |
|
Spatial algorithms ☝️ branch has been merged and has a dev release on Mason. Onward. |
|
Looks like -weffc++ errors are throwing: but it looks like this isn't a big deal according to SO. I imagine I can bypass this by reversing the conditional to something like |
|
@mapsam - awesome work on this. Did a quick review and here are my thoughts:
|
springmeyer
left a comment
There was a problem hiding this comment.
Made minor comments above. This looks great otherwise, so approving.
I don't - that feels like a really good test to add. I'll work on updating one of them to check if the values are the same in the resulting feature collection.
Mind updating this link @springmeyer?
Indeed it is. I will update it 👌 My todos:
|
|
@mapsam - okay, if the difference is in spatial-algos, then I'm comfortable with you applying a fuzzy comparison in vtquery rather than exact. It looks like this is what spatial-algos is doing by using |
|
@springmeyer how does this look as a viable checkClose function? function checkClose(a, b, epsilon) {
return 1*(a-b) < epsilon;
}And usage in tests with same epsilon as spatial-algorithms |
|
looks great @mapsam!
… On Nov 28, 2017, at 4:01 PM, Sam Matthews ***@***.***> wrote:
@springmeyer <https://github.com/springmeyer> how does this look as a viable checkClose function?
function checkClose(a, b, epsilon) {
return 1*(a-b) < epsilon;
}
And usage in tests with same epsilon as spatial-algorithms
assert.ok(checkClose(number_a, number_b, 1e-6));
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#42 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AABPTI_NbEgu79yEXLLMWK76cIdCH0cOks5s7J7BgaJpZM4Qnyhi>.
|
|
Great! Okay, only one more thing I'm seeing - linux seems to return results with the same distance in a different order, despite the distance being the same number. Must they be in the same order? I would expect them to be in parsing order based on the operations of the priority queue, but this is hitting my expertise in how the priority queue resorts itself. |
|
@mapsam - I'm not sure why, but I have a hunch and if I'm right @flippmoke can explain the details tomorrow. My hunch is that the sort is not "stable". In the past when using |
|
@springmeyer I lied so badly! 🙈 We're never using distance from closest_point as a return, and are only using it in the conditional comparison. What we're returning is a value from cheap-ruler based on latitude and longitude inputs. So basically we convert vector tile coordinates into latitude and longitude coordinates (cast to doubles), then use cheap-ruler to calculate the distance between them in meters with this function. Numbers, as they move through vtquery (logged with std::clog): # x,y
tilecoords: 601, 258
lnglat: -87.7963, 41.8675
meters: 9.43636
ResObjDistance: 9.43636
js distance: 9.436356889343624So, logging these numbers, it seems that closest_point and cheap-ruler work as expected and keep our numbers nice and rounded. It's when we pass from the v8 thread into a javascript value when we start getting sloppy. I think all javascript floating numbers are 64 bit, so not sure if there's anything we can do here other than continue asserting on the checkClose function? |
|
Just a confirmation that these tests are passing on macosx and not linux. Appears we cannot rely on order - @flippmoke have you seen priority_queue's react differently on different operating systems? |
|
@mapsam, nice debugging. As an extra assurance that the numbers are changing at the JS conversion I recommend adding a std::setprecision call to your std::clog call. Set the precision higher so that you can see more digits after the decimal (equal to the JS). What I’d look for is that even with higher display precision the ‘ResObjDistance’ output is still different. |
|
Nice @springmeyer - here's the output with std::setprecision(20): Not sure how to read this, though. |
|
@mapsam - thanks for posting that. So that helps show that the precision output was misleading because it was rounding when the C++ number was printed. So: Is actually: Which look identical when printed (other than the precision): 9.4363568893436244878 # C++
9.436356889343624 # JSAm I following along right? |
|
@springmeyer yep, that's right. I think it'll be best to just make sure our tests are checking a rounded number, considering anything beyond 4 decimal points is in the micrometers of distance. I tried to recreate the priority queue sorting differences in a docker container (ubuntu:16.04) without any luck. The sort results end up the same. Perhaps I'm not using the proper versions? |
|
Sounds good on checking a less precise number overall in the tests @mapsam
As far as the priority queue issue which exact error is caused by that? Is it the error on travis where features properties are not matching the expected since they return in a different order on travis? If you could not replicate with a Dockerfile that is interesting. Could you post the Dockerfile?
… On Nov 29, 2017, at 3:36 PM, Sam Matthews ***@***.***> wrote:
@springmeyer yep, that's right. I think it'll be best to just make sure our tests are checking a rounded number, considering anything beyond 4 decimal points is in the micrometers of distance.
I tried to recreate the priority queue sorting differences in a docker container without any luck. The sort results end up the same. Perhaps I'm not using the proper versions?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
@springmeyer I've tried a few more attempts, and was able to recreate the error once, but I think I got lucky as I'm not able to get it compiled any longer. Now this branch includes a dockerfile you can build with Not sure what's happening here, but perhaps I've set up the dockerfile incorrectly? |
|
Remove the fsanitize=address from the Dockerfile and that error should go away. That worked for gzip-hpp but needs more tooling to work with a node-addon.
… On Nov 29, 2017, at 5:42 PM, Sam Matthews ***@***.***> wrote:
@springmeyer I've tried a few more attempts, and was able to recreate the error once, but I think I got lucky as I'm not able to get it compiled any longer. Now this branch includes a dockerfile you can build with docker build -t vtquery . and connect to it via docker run -it vtquery and then run make test inside, but I'm seeing some issues:
Error: /usr/local/src/lib/binding/vtquery.node: undefined symbol: __asan_report_store4
Not sure what's happening here, but perhaps I've set up the dockerfile incorrectly?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
Lovely, that did it @springmeyer. Thanks for the 👀! Now back to the investigation. |
|
I've removed the test for the time being and opened a ticket #44 to remind us of this in the future. |
|
Failing tests are due to travis regressions which have been ticketed in mapbox/node-cpp-skel#93 |
|
Thanks @flippmoke and @springmeyer for the help here! |
|
epic PR @mapsam 🙌 |

Integrating vector tile 2.x and a "sort during"
What changed?
0.0, resolves radius=0 leads to zero results with PIP #36 (closing Check for "within" results from closest_point #41)benchmarks
this branch
master
cc @flippmoke