❔ In-Memory efficient GeoJSON Spatial Search for LineStrings nearest point and bounding box/envelope
I'm currently working on a project that involves handling a substantial amount of GeoJSON data from OpenStreetMap. My goal is to determine whether a given latitude and longitude point falls within the bounds of a LineString within the GeoJSON, all while avoiding the use of a database (although I'm aware of the trade-offs).
My proposed approach is to create a dictionary where each LineString's envelope or bounding box is calculated and stored as the key, with the LineString itself as the corresponding value. When provided with a latitude and longitude, I plan to filter LineStrings based on their bounding boxes first, and then perform more intensive calculations to determine if the point is within a specified distance from the LineString.
I'm currently facing two challenges:
Calculating Bounding Boxes Without Using External Libraries: I'm not sure how to efficiently calculate bounding boxes for LineStrings, especially for curvy roads, and I'm interested in learning and implementing the mathematics myself rather than relying on external libraries. Are there any resources or insights you could provide to help me understand this better?
Time Complexity: What would be the time complexity of this approach, and are there more efficient methods or alternatives for quickly filtering through an array of coordinates to find the closest matching LineString?
This project is primarily for purposes to enhance my understanding of mathematics and geospatial data. Any guidance or insights would be greatly appreciated!
1 Reply
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.