Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 540687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:15:58+00:00 2026-05-13T10:15:58+00:00

Given a scenario where there are millions of potentially overlapping bounding boxes of variable

  • 0

Given a scenario where there are millions of potentially overlapping bounding boxes of variable sizes less the 5km in width.

Create a fast function with the arguments findIntersections(Longitude,Latitude,Radius) and the output is a list of those bounding boxes ids where each bounding box origin is inside the perimeter of the function argument dimensions.

How do I solve this problem elegantly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:15:58+00:00Added an answer on May 13, 2026 at 10:15 am

    This is normally done using an R-tree data structure

    dbs like mysql or postgresql have GIS modules that use an r-tree under the hood to quickly retrieve locations within a certain proximity to a point on a map.

    From http://en.wikipedia.org/wiki/R-tree:

    R-trees are tree data structures that
    are similar to B-trees, but are used
    for spatial access methods, i.e., for
    indexing multi-dimensional
    information; for example, the (X, Y)
    coordinates of geographical data. A
    common real-world usage for an R-tree
    might be: “Find all museums within 2
    kilometres (1.2 mi) of my current
    location”.

    The data structure splits space with
    hierarchically nested, and possibly
    overlapping, minimum bounding
    rectangles (MBRs, otherwise known as
    bounding boxes, i.e. “rectangle”, what
    the “R” in R-tree stands for).

    The Priority R-Tree (PR-tree) is a variant that has a maximum running time of:

    "O((N/B)^(1-1/d)+T/B) I/Os, where N is the number of d-dimensional (hyper-)
    rectangles stored in the R-tree, B is the disk block size, and T is the output
    size."
    

    In practice most real-world queries will have a much quicker average case run time.

    fyi, in addition to the other great code posted, there’s some cool stuff like SpatiaLite and SQLite R-tree module

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: There is a website with 700-900 concurrent unique visitors at any given time.
I have the following scenarios: Scenario: Create a game with valid information Given I
Given a scenario: I have my own system's object structure. Now there are more
SCENARIO: Given that a model called Edition has its community feature enabled I want
Seems like a standard approach for an ioc when given a scenario like (C#
The following scenario is given: /Collection1 (a number of users are subscribed to this
Scenario Outline: Verify Full ad details Given I am on the xxxxx classified home
Scenario: Change a member to ABC 60 days before anniversary date Given Repeat When+Then
I am running the following feature: Scenario: viewing existing images Given I am on
Hi here is what I what I have: Scenario Outline: Seatching for stuff Given

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.