-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: finding nearby points of interest (POIs) for location-based ser… #34
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Mankavelda -- you will need to add a dune
file to build main.ml
. You should be able to use the tests as a basis to do that.
open Rtree | ||
open Printf | ||
(* Sample Point of Interest data structure *) | ||
type poi = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about making this it's own module:
module Poi = struct
type t = {...}
end
let ic = open_in filename in | ||
let csv = Csv.of_channel ~has_header:true ic in | ||
let pois = ref [] in | ||
Csv.iter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this more functional I think we should use fold_left instead of iter + mutable state :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @patricoferris, will do that
(* Load geospatial data from external csv file *) | ||
let csv = | ||
List.map (fun name -> name, Csv.load name) | ||
[ "example/pois.csv"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not valid OCaml as we need an in
afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok @patricoferris , I will have to check and correct that
…vices.
This PR makes the following changes
*closes issue #33
Real world example: finding nearby points of interest (POIs) for location-based services.
description
This pull request introduces a code example that shows the application of the R-tree library to solve a real-world challenge: finding nearby points of interest (POIs) for location-based services. The example demonstrates how the R-tree data structure efficiently organizes and queries geospatial data, which is vital for applications such as navigation, mapping, and location-based recommendations.
Key Components
Sample Data: The code example defines a custom data structure, poi, to represent points of interest. Each poi object includes attributes like name, latitude, and longitude, which are typical of geospatial data.
Integration with R-tree Library: The code demonstrates the seamless integration of the OCaml R-tree library. The library's functionalities, including creating an R-tree, inserting data, and performing spatial queries, are used in the example.
Data Insertion: The code inserts a list of sample POIs into the R-tree. This operation organizes the POIs spatially within the tree structure, which is essential for efficient spatial queries.
Spatial Query: To illustrate the R-tree's capabilities, the code performs a spatial query to find nearby POIs within a specified radius of a given location. The R-tree's range query functionality is employed, optimizing the process of identifying relevant points of interest.