feat: finding nearby points of interest (POIs) for location-based ser…#34
Open
Mankavelda wants to merge 1 commit into
Open
feat: finding nearby points of interest (POIs) for location-based ser…#34Mankavelda wants to merge 1 commit into
Mankavelda wants to merge 1 commit into
Conversation
Contributor
patricoferris
left a comment
There was a problem hiding this comment.
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 = { |
Contributor
There was a problem hiding this comment.
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 |
Contributor
There was a problem hiding this comment.
To make this more functional I think we should use fold_left instead of iter + mutable state :))
| (* Load geospatial data from external csv file *) | ||
| let csv = | ||
| List.map (fun name -> name, Csv.load name) | ||
| [ "example/pois.csv"] |
Contributor
There was a problem hiding this comment.
Not valid OCaml as we need an in afterwards.
Author
There was a problem hiding this comment.
Ok @patricoferris , I will have to check and correct that
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…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.