hello! I've been investigating an issue with Geose...
# community-help
a
hello! I've been investigating an issue with Geosearch on Typesense for a little while now and would greatly appreciate any insight/help 😿 Background: • Typesense v28.0 ◦ 2 GB RAM ◦ 2 vCPUs, 4 hr burst per day • I have a collection storing job postings ◦ Each document (job posting) has attributes ▪︎
geolocations
geopoint[] Problem: When searching for job postings that are within a bounding box for Canada, it does NOT contain results of job postings that only have
geolocations
in Toronto; this does not make sense, as Toronto is a city contained in Canada. • Canada bounding box used in search:
geolocations:(83.13505, -52.619409, 83.13505, -141.002742, 41.729668, -141.002742, 41.729668, -52.619409)
• Toronto bounding box used in search:
geolocations:(43.855457, -79.115243, 43.855457, -79.639265, 43.580996, -79.639265, 43.580996, -79.115243)
• Example Toronto geopoint that is returned in Toronto query but NOT in Canada query:
[ "43.653226", "-79.3831843" ]
• Example Vancouver geopoint that is returned in Canada query:
[ "49.2827291", "-123.1207375" ]
Debugging Results: • The Toronto and Canada bounding boxes seem to be correct (I've included the bounding boxes as GeoJSON and visualized using bboxfinder.com) • Doesn't seem to be a 180th meridian issue Steps for reproducing 1. Create new Typesense collection using the attached
documents.jsonl
file (contains two locations, one in Vancouver, one in Toronto) 2. Make search using JSON query stored in
query.json
3. See that only the Vancouver result is returned
j
To make it easy to debug, could you share a set of curl commands like this: https://gist.github.com/jasonbosco/7c3432713216c378472f13e72246f46b
👍 1
a
@Jason Bosco Here they are -- thank you 🙏
k
If you plot the provided Canada boundary and Toronto lat/long values, it looks like this: http://www.gcmap.com/mapui?P=83.13N+52.61W+-+83.13N+141W+-+41.72N+141W+-+41.72N+52.61W+-+83N+53W,+44N+79W Toronto indeed falls outside the given boundary, so it's not fetched as a match. I've actually fallen for this exact issue before 🙂 While the individual lat/long values that make up the Canada boundary is correct, the geodesic (shortest path) connecting them is not a straight line on this projection (Mercator), which I think bboxfinder uses. I suspect it's not easy to represent Canada accuractely using a 4 sided polygon because of how the lines connect over the spherical earth.
a
@Kishore Nallan I guess everyday you learn something new haha -- thanks for the insight Kishore, and appreciate the visualization. Glad to know this isn't a Typesense issue 🙌
🙌 1