Cartodb: Find Nearest analysis

Created on 6 Apr 2017  路  18Comments  路  Source: CartoDB/cartodb

Implement the new _Find nearest_ analysis.

User story:
To be able to look for a limited number of closest points, organized by categories, to my points of origin, e.g. _"I have this table of competitors and I want to find the 5 stores of this brand that are closer to my stores"_

Functionality:
Find N closest points, based on the linear distance, from a target point table per every point in a source table, with the possibility of finding N points for each of the categories in a selectable target's table column.

The resulting table will include the target geometries with their related _source_cdb_id_ so they could afterwards be joined with the source table. In the case of a categorized analysis, output geometries will be maybe duplicated but will have different _ids_.

UI

image

cc @rochoa

Analysis feature

All 18 comments

Nearest Neighbors may be a confusing name for this analysis, because it's usually used for Voronoi cells

On the other hand, we are not looking for "neighbors" (lookalikes or relatives) but features from other node (target) that are the closest to our source. Kurz und gut: hydrants are not neighbors of houses, but this is the natural analysis you would apply them

cc @noguerol

I propose we use "Find nearest" as it is how it's called in some other tools

What category does 'find nearest' belong to?

image

Analyze and predict

  • [x] I've found an issue (it might be our problem). It's that the UI was wrong in the mockup (attaching the correct one 鈥撀營 hope it doesn't become very difficult).
    analysis - nearest neighbours 01

  • [ ] We should review the policy about duplicated data generated by this analysis ( @rochoa , @AbelVM, @javisantana, @noguerol). Since it's very easy to end up with tons of duplicated points (one each time a point is nearest to more than one feature in the source layer), and that would require post-processing the data for analysis. 鈥撀營 still need to think in a solution

Nothing else found so far! Implementation working like a charm!

The first issue is fixed. You can test it in ded01.

While we figure out (2) we can:

  • [ ] Tweak the the subtitles for those new two sections in (1):

"_Define your criteria_" --> "_Select the target point layer_"
"_Define and limit your result_" --> "_Define and categorize the number of results_"

  • [ ] Plus there is a tweak to do that we discussed in the past (and was unfortunately not reflected on the design) that now with two blocks makes even more sense: to put the "_categorized_" dropdown below the "_max results_" slider -'cause is optional- and change its literal from "_categorized_" to "_per category_" -because it may be confusing wether those max results are to all categories or per category.

Hey mates, could we add the things we should change in the PR please? 馃拫

I've found something. It looks like there is a column called ranking and another one called source_rank. What is the different between those? @rochoa @AbelVM

You're right:

  • Ranking: it's always there. (not needed as output, actually)
  • Closest_rank: if the user asks for N>1 results (globally or per category), then this is the ranking of each result (within the category if any)

so, should we remove that column from the output then?

maybe it can be solved as part of what's left to do in https://github.com/CartoDB/camshaft/pull/281 ? cc @rochoa

https://github.com/CartoDB/camshaft/pull/281 is finished and deployed to production.

_m谩quina!_ ^^^

@noguerol @xavijam rememeber we need to instrumentate this UI properly!

Blocked until https://github.com/CartoDB/cartodb/issues/12040 is implemented in the current PR.

Not blocked anymore since we have decided to go on with the PR and then add the needed track classes.

Deployed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ivanmalagon picture ivanmalagon  路  3Comments

fernando-carto picture fernando-carto  路  5Comments

javitonino picture javitonino  路  5Comments

ramiroaznar picture ramiroaznar  路  5Comments

arianaescobar picture arianaescobar  路  4Comments