I’m trying to implement solr to use the spatial searches to find the distance between points stored in my database. The lat/lon comes from Google Maps API, which I assumed could be used as is in Solr. Is this assumption correct? The reason I ask is because I’m getting some strange results for distance:
Example 1
- Origin: 45.15,-93.85 (Buffalo, NY – from solr spatial example)
- Location: 42.88,-78.8 (Buffalo, NY – from google maps api)
- Distance: 1227.7522
Example 2
- Origin: 45.15,-93.85 (Buffalo, NY – from solr spatial example)
- Location: 40.67,-73.9 (Brooklyn, NY – from google maps api)
- Distance: 1694.3356
km or miles, the distances are way off. I’m not a geo/spacial expert, so any tips on what might be going on would be much appreciated. I’d be happy to share config if you think it’s needed.
Thanks!
Heh, the coordinates you’re using for Buffalo, New York are incorrect from the Solr example. Those are the coordinates for Buffalo, Minnesota. From a simple Google search it looks like Buffalo, NY might be closer to 42.8864° N, 78.8786° W (42.88, -78.87) which is what you’re claiming the Google Maps API is reporting.