Skip to content

Use kd-tree for lat,long search#9

Open
crhallberg wants to merge 1 commit intodevfrom
kdtree
Open

Use kd-tree for lat,long search#9
crhallberg wants to merge 1 commit intodevfrom
kdtree

Conversation

@crhallberg
Copy link
Owner

  • BREAKING: REMOVES MULTI RETURN.

@crhallberg crhallberg requested a review from Copilot May 19, 2025 16:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the existing zip code lookup by location with a new kd‐tree implementation. Key changes include:

  • Introducing a new kd‐tree implementation and updating the corresponding update and index modules.
  • Removing the old multi-return functionality and updating tests accordingly.
  • Bumping the package version and adding an esbuild configuration.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
update.mjs New implementation using the kd‐tree for location searches.
update.js Removal of the old zoned index approach.
test/by-location.js Skipping the multi-return test in line with breaking changes.
src/kd-tree.mjs New kd‐tree class implementation with private methods.
src/index.mjs Updated lookup functions to use kd‐tree for location queries.
package.json Version bump and script updates for new implementation.
esbuild.config.mjs New configuration script for building the project.
Comments suppressed due to low confidence (3)

test/by-location.js:15

  • Since the multi-return functionality has been removed per the breaking changes, consider removing this skipped test altogether to avoid confusion.
it.skip('return multiple closest when asked', function() {

src/kd-tree.mjs:7

  • The use of private class fields (e.g., '#leaf') requires language support beyond ES2018; consider updating the target environment in esbuild.config.mjs or adding appropriate transpilation support.
#leaf(item) {

src/index.mjs:41

  • [nitpick] For consistency with the parsed floating-point values in the kd‐tree inserts, consider using parseFloat (or Number) for validating latitude and longitude in getByLocation.
if (typeof lat === "undefined" || isNaN(parseInt(lat, 10)) || typeof long === "undefined" || isNaN(parseInt(long, 10))) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant