You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by PeterKerk <ve...@hotmail.com> on 2010/09/19 17:04:35 UTC

Calculating distances in Solr using longitude latitude

I want users to be able to filter buildings in my database, by enerting a
random zipcode with a certain distance around it (in kilometers). 
e.g.: 90210 with a radius of 50kilometer.

The longitude and latitude of a specific building are in the database.
When the user searches on a zipcode, I can get the respective longitude and
latitude from Google Maps.

Then in Solr I want to return all buildings from my database that are in the
radius of the 50km with the entered zipcode as the center...

I checked this url for calculation, but not sure if there's any best
practice on doing this...
http://briancray.com/2009/04/01/how-to-calculate-the-distance-between-two-addresses-with-javascript-and-google-maps-api/

Any examples on how to do this?
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1524297.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Calculating distances in Solr using longitude latitude

Posted by Dennis Gearon <ge...@sbcglobal.net>.
hmmmmmm,

So what works? I 'only' need:

     1/ sorting by distance (maybe, probably could be avoided in Solr)
     2/ filtering by max distance, or at least a bounding box
     3/ a pseudo field - distance from given point for each returned result (REALLY a must).

Any of this available now?

Bare bones, if I had a bounding box that worked across the poles, I could probably use a function as the value of the psuedo field, right?



Dennis Gearon

Signature Warning
----------------
EARTH has a Right To Life,
  otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Fri, 9/24/10, Lance Norskog <go...@gmail.com> wrote:

> From: Lance Norskog <go...@gmail.com>
> Subject: Re: Calculating distances in Solr using longitude latitude
> To: solr-user@lucene.apache.org
> Date: Friday, September 24, 2010, 6:30 PM
> As it turns out, the problem is not
> trivial in general, and shoehorning it into an existing
> search system nicely is also not simple. I think the current
> spatial stuff is the third go-round on doing GIS in
> Lucene/Solr.
> 
> PeterKerk wrote:
> > It would be such a shame if there's no way to get it
> now
> > already...particularly in today's online services,
> geolocation is one of the
> > hottest things there is, I definitely hope this
> feature gets major priority
> > over other features.
> > 
> > Also same question as Dennis: whats the timeline on
> this feature? Or even a
> > way to get it running in the current release?
> >    

Re: Calculating distances in Solr using longitude latitude

Posted by Lance Norskog <go...@gmail.com>.
As it turns out, the problem is not trivial in general, and shoehorning 
it into an existing search system nicely is also not simple. I think the 
current spatial stuff is the third go-round on doing GIS in Lucene/Solr.

PeterKerk wrote:
> It would be such a shame if there's no way to get it now
> already...particularly in today's online services, geolocation is one of the
> hottest things there is, I definitely hope this feature gets major priority
> over other features.
>
> Also same question as Dennis: whats the timeline on this feature? Or even a
> way to get it running in the current release?
>    

Re: Calculating distances in Solr using longitude latitude

Posted by Thomas Joiner <th...@gmail.com>.
Re: your problems with JIRA

I have no idea what caused it/what resolved it but I have had the same
problem as you.  Assuming, that is, that the problem that is occurring is
when you click on a link to an issue, it instead takes you to
https://issues.apache.org/jira/secure/Dashboard.jspa  Or perhaps the page
above it...I don't remember clearly any more.

If you click "Browse Project" then navigate to Solr, and type the issue
number in the quick search box, it should get you to the issue.  I'm sorry I
don't know a simpler way to do this/why it isn't working correctly, but
maybe in your case it will magically resolve itself like it did in my case.

(Sorry for the somewhat off-topic post, however since he did make a comment
about it on this thread, I felt it appropriate to respond on this thread as
well.)

On Wed, Sep 22, 2010 at 10:30 AM, Dennis Gearon <ge...@sbcglobal.net>wrote:

> Well, do the least expensive operations first, all the other filtering on
> keywords, dates, other fields, then the bounding box, then generate the
> distances.
>
> Really not sure what is local solr, but going to look now.
> Dennis Gearon
>
> Signature Warning
> ----------------
> EARTH has a Right To Life,
>  otherwise we all die.
>
> Read 'Hot, Flat, and Crowded'
> Laugh at http://www.yert.com/film.php
>
>
> --- On Wed, 9/22/10, PeterKerk <ve...@hotmail.com> wrote:
>
> > From: PeterKerk <ve...@hotmail.com>
> > Subject: Re: Calculating distances in Solr using longitude latitude
> > To: solr-user@lucene.apache.org
> > Date: Wednesday, September 22, 2010, 1:41 AM
> >
> >
> > Dennis Gearon wrote:
> > >
> > > Soooooo, the short term answer is to use a function
> > column to query
> > > against? Prefereably with a bounding box, of course.
> > :-)
> > >
> >
> > What do you mean by that? Calculate all locations within a
> > certain range
> > (bounding box) and query on that?
> > I hope not, because that would be a very unfriendly
> > solution.
> >
> > Im still surprised that this is not a bigger priority for
> > the Solr
> > developers.
> >
> > I think the better solution would then be to use LocalSolr,
> > but I dont know:
> > 1. if their implementation offers the same functions as the
> > current Solr
> > release and
> > 2. if I was to use LocalSolr I woud simply use their
> > implementation of Solr
> > instead of Solr OR that I have to copy some classes to my
> > current deployment
> > of Solr
> >
> > pff :)
> > --
> > View this message in context:
> http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1559728.html
> > Sent from the Solr - User mailing list archive at
> > Nabble.com.
> >
>

Re: Calculating distances in Solr using longitude latitude

Posted by Erick Erickson <er...@gmail.com>.
Well, rather than be surprised, you could jump right and *make*
it a priority, by contributing a patch :).

But before you do, you might want to look at the ongoing discussion at:

https://issues.apache.org/jira/browse/SOLR-2125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12913577#action_12913577

Best
Erick


On Wed, Sep 22, 2010 at 4:41 AM, PeterKerk <ve...@hotmail.com> wrote:

>
>
> Dennis Gearon wrote:
> >
> > Soooooo, the short term answer is to use a function column to query
> > against? Prefereably with a bounding box, of course. :-)
> >
>
> What do you mean by that? Calculate all locations within a certain range
> (bounding box) and query on that?
> I hope not, because that would be a very unfriendly solution.
>
> Im still surprised that this is not a bigger priority for the Solr
> developers.
>
> I think the better solution would then be to use LocalSolr, but I dont
> know:
> 1. if their implementation offers the same functions as the current Solr
> release and
> 2. if I was to use LocalSolr I woud simply use their implementation of Solr
> instead of Solr OR that I have to copy some classes to my current
> deployment
> of Solr
>
> pff :)
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1559728.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Calculating distances in Solr using longitude latitude

Posted by Dennis Gearon <ge...@sbcglobal.net>.
Well, do the least expensive operations first, all the other filtering on keywords, dates, other fields, then the bounding box, then generate the distances.

Really not sure what is local solr, but going to look now.
Dennis Gearon

Signature Warning
----------------
EARTH has a Right To Life,
  otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Wed, 9/22/10, PeterKerk <ve...@hotmail.com> wrote:

> From: PeterKerk <ve...@hotmail.com>
> Subject: Re: Calculating distances in Solr using longitude latitude
> To: solr-user@lucene.apache.org
> Date: Wednesday, September 22, 2010, 1:41 AM
> 
> 
> Dennis Gearon wrote:
> > 
> > Soooooo, the short term answer is to use a function
> column to query
> > against? Prefereably with a bounding box, of course.
> :-)
> > 
> 
> What do you mean by that? Calculate all locations within a
> certain range
> (bounding box) and query on that?
> I hope not, because that would be a very unfriendly
> solution.
> 
> Im still surprised that this is not a bigger priority for
> the Solr
> developers.
> 
> I think the better solution would then be to use LocalSolr,
> but I dont know:
> 1. if their implementation offers the same functions as the
> current Solr
> release and 
> 2. if I was to use LocalSolr I woud simply use their
> implementation of Solr
> instead of Solr OR that I have to copy some classes to my
> current deployment
> of Solr
> 
> pff :)
> -- 
> View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1559728.html
> Sent from the Solr - User mailing list archive at
> Nabble.com.
> 

Re: Calculating distances in Solr using longitude latitude

Posted by PeterKerk <ve...@hotmail.com>.

Dennis Gearon wrote:
> 
> Soooooo, the short term answer is to use a function column to query
> against? Prefereably with a bounding box, of course. :-)
> 

What do you mean by that? Calculate all locations within a certain range
(bounding box) and query on that?
I hope not, because that would be a very unfriendly solution.

Im still surprised that this is not a bigger priority for the Solr
developers.

I think the better solution would then be to use LocalSolr, but I dont know:
1. if their implementation offers the same functions as the current Solr
release and 
2. if I was to use LocalSolr I woud simply use their implementation of Solr
instead of Solr OR that I have to copy some classes to my current deployment
of Solr

pff :)
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1559728.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Calculating distances in Solr using longitude latitude

Posted by Dennis Gearon <ge...@sbcglobal.net>.
For some reason, I thought that it was already in the released code, also.

Soooooo, the short term answer is to use a function column to query against? Prefereably with a bounding box, of course. :-)
Dennis Gearon

Signature Warning
----------------
EARTH has a Right To Life,
  otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Tue, 9/21/10, PeterKerk <ve...@hotmail.com> wrote:

> From: PeterKerk <ve...@hotmail.com>
> Subject: Re: Calculating distances in Solr using longitude latitude
> To: solr-user@lucene.apache.org
> Date: Tuesday, September 21, 2010, 1:18 AM
> 
> It would be such a shame if there's no way to get it now
> already...particularly in today's online services,
> geolocation is one of the
> hottest things there is, I definitely hope this feature
> gets major priority
> over other features.
> 
> Also same question as Dennis: whats the timeline on this
> feature? Or even a
> way to get it running in the current release?
> -- 
> View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1533936.html
> Sent from the Solr - User mailing list archive at
> Nabble.com.
> 

Re: Calculating distances in Solr using longitude latitude

Posted by Dennis Gearon <ge...@sbcglobal.net>.
I'm pretty new to the Apache Jira pages. I've not worked with a public, OSS version control sitation. The 'issue' numbers see concise, but when I click what I think will give more information about that issue, it takes me to the Apache project as whole, not the Lucene/Spatial Search 'issue' info page(if there is one). I'm used to more of the casual use of source forge.

Dennis Gearon

Signature Warning
----------------
EARTH has a Right To Life,
  otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Wed, 9/22/10, Jan Høydahl / Cominvent <ja...@cominvent.com> wrote:

> From: Jan Høydahl / Cominvent <ja...@cominvent.com>
> Subject: Re: Calculating distances in Solr using longitude latitude
> To: solr-user@lucene.apache.org
> Date: Wednesday, September 22, 2010, 12:11 AM
> :-)
> 
> Also, that Wiki page clearly states in the very first line
> that it talks about uncommitted stuff "Solr4.0". I think
> that is pretty clear.
> 
> --
> Jan Høydahl, search solution architect
> Cominvent AS - www.cominvent.com
> 
> On 22. sep. 2010, at 03.31, Lance Norskog wrote:
> 
> > Developers, like marketers, have this confusing habit
> of speaking both in the present and an imaginary utopian
> future.
> > 
> > Dennis Gearon wrote:
> >> This is what made me think it was doable now.
> >> 
> >> http://wiki.apache.org/solr/SpatialSearch
> >> 
> >> 
> >> Dennis Gearon
> >> 
> >> Signature Warning
> >> ----------------
> >> EARTH has a Right To Life,
> >>   otherwise we all die.
> >> 
> >> Read 'Hot, Flat, and Crowded'
> >> Laugh at http://www.yert.com/film.php
> >> 
> >> 
> >> --- On Tue, 9/21/10, PeterKerk<ve...@hotmail.com> 
> wrote:
> >> 
> >>   
> >>> From: PeterKerk<ve...@hotmail.com>
> >>> Subject: Re: Calculating distances in Solr
> using longitude latitude
> >>> To: solr-user@lucene.apache.org
> >>> Date: Tuesday, September 21, 2010, 1:18 AM
> >>> 
> >>> It would be such a shame if there's no way to
> get it now
> >>> already...particularly in today's online
> services,
> >>> geolocation is one of the
> >>> hottest things there is, I definitely hope
> this feature
> >>> gets major priority
> >>> over other features.
> >>> 
> >>> Also same question as Dennis: whats the
> timeline on this
> >>> feature? Or even a
> >>> way to get it running in the current release?
> >>> -- 
> >>> View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1533936.html
> >>> Sent from the Solr - User mailing list archive
> at
> >>> Nabble.com.
> >>> 
> >>>     
> 
> 

Re: Calculating distances in Solr using longitude latitude

Posted by Jan Høydahl / Cominvent <ja...@cominvent.com>.
:-)

Also, that Wiki page clearly states in the very first line that it talks about uncommitted stuff "Solr4.0". I think that is pretty clear.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

On 22. sep. 2010, at 03.31, Lance Norskog wrote:

> Developers, like marketers, have this confusing habit of speaking both in the present and an imaginary utopian future.
> 
> Dennis Gearon wrote:
>> This is what made me think it was doable now.
>> 
>> http://wiki.apache.org/solr/SpatialSearch
>> 
>> 
>> Dennis Gearon
>> 
>> Signature Warning
>> ----------------
>> EARTH has a Right To Life,
>>   otherwise we all die.
>> 
>> Read 'Hot, Flat, and Crowded'
>> Laugh at http://www.yert.com/film.php
>> 
>> 
>> --- On Tue, 9/21/10, PeterKerk<ve...@hotmail.com>  wrote:
>> 
>>   
>>> From: PeterKerk<ve...@hotmail.com>
>>> Subject: Re: Calculating distances in Solr using longitude latitude
>>> To: solr-user@lucene.apache.org
>>> Date: Tuesday, September 21, 2010, 1:18 AM
>>> 
>>> It would be such a shame if there's no way to get it now
>>> already...particularly in today's online services,
>>> geolocation is one of the
>>> hottest things there is, I definitely hope this feature
>>> gets major priority
>>> over other features.
>>> 
>>> Also same question as Dennis: whats the timeline on this
>>> feature? Or even a
>>> way to get it running in the current release?
>>> -- 
>>> View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1533936.html
>>> Sent from the Solr - User mailing list archive at
>>> Nabble.com.
>>> 
>>>     


Re: Calculating distances in Solr using longitude latitude

Posted by Lance Norskog <go...@gmail.com>.
Developers, like marketers, have this confusing habit of speaking both 
in the present and an imaginary utopian future.

Dennis Gearon wrote:
> This is what made me think it was doable now.
>
> http://wiki.apache.org/solr/SpatialSearch
>
>
> Dennis Gearon
>
> Signature Warning
> ----------------
> EARTH has a Right To Life,
>    otherwise we all die.
>
> Read 'Hot, Flat, and Crowded'
> Laugh at http://www.yert.com/film.php
>
>
> --- On Tue, 9/21/10, PeterKerk<ve...@hotmail.com>  wrote:
>
>    
>> From: PeterKerk<ve...@hotmail.com>
>> Subject: Re: Calculating distances in Solr using longitude latitude
>> To: solr-user@lucene.apache.org
>> Date: Tuesday, September 21, 2010, 1:18 AM
>>
>> It would be such a shame if there's no way to get it now
>> already...particularly in today's online services,
>> geolocation is one of the
>> hottest things there is, I definitely hope this feature
>> gets major priority
>> over other features.
>>
>> Also same question as Dennis: whats the timeline on this
>> feature? Or even a
>> way to get it running in the current release?
>> -- 
>> View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1533936.html
>> Sent from the Solr - User mailing list archive at
>> Nabble.com.
>>
>>      

Re: Calculating distances in Solr using longitude latitude

Posted by Dennis Gearon <ge...@sbcglobal.net>.
This is what made me think it was doable now.

http://wiki.apache.org/solr/SpatialSearch


Dennis Gearon

Signature Warning
----------------
EARTH has a Right To Life,
  otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Tue, 9/21/10, PeterKerk <ve...@hotmail.com> wrote:

> From: PeterKerk <ve...@hotmail.com>
> Subject: Re: Calculating distances in Solr using longitude latitude
> To: solr-user@lucene.apache.org
> Date: Tuesday, September 21, 2010, 1:18 AM
> 
> It would be such a shame if there's no way to get it now
> already...particularly in today's online services,
> geolocation is one of the
> hottest things there is, I definitely hope this feature
> gets major priority
> over other features.
> 
> Also same question as Dennis: whats the timeline on this
> feature? Or even a
> way to get it running in the current release?
> -- 
> View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1533936.html
> Sent from the Solr - User mailing list archive at
> Nabble.com.
> 

Re: Calculating distances in Solr using longitude latitude

Posted by PeterKerk <ve...@hotmail.com>.
It would be such a shame if there's no way to get it now
already...particularly in today's online services, geolocation is one of the
hottest things there is, I definitely hope this feature gets major priority
over other features.

Also same question as Dennis: whats the timeline on this feature? Or even a
way to get it running in the current release?
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1533936.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Calculating distances in Solr using longitude latitude

Posted by Dennis Gearon <ge...@sbcglobal.net>.
What's the timeline on that?

For now, we write our own functions and sort by them?

Dennis Gearon

Signature Warning
----------------
EARTH has a Right To Life,
  otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Mon, 9/20/10, Lance Norskog <go...@gmail.com> wrote:

> From: Lance Norskog <go...@gmail.com>
> Subject: Re: Calculating distances in Solr using longitude latitude
> To: solr-user@lucene.apache.org
> Date: Monday, September 20, 2010, 9:40 PM
> There is a third-party add-on for
> Solr 1.4 called LocalSolr. It has a different API than the
> upcoming SpatialSearch stuff, and will probably not live on
> in future releases.
> 
> The LatLonType stuff is definitely only on the trunk, not
> even 3.x.
> 
> PeterKerk wrote:
> > Hi Dennis,
> > 
> > Good suggestion, but I see that most of that is Solr
> 4.0 functionality,
> > which has not been released yet.
> > How can I still use the longitude latitude
> functionality (LatLonType)?
> > 
> > Thanks!
> >    

Re: Calculating distances in Solr using longitude latitude

Posted by Lance Norskog <go...@gmail.com>.
There is a third-party add-on for Solr 1.4 called LocalSolr. It has a 
different API than the upcoming SpatialSearch stuff, and will probably 
not live on in future releases.

The LatLonType stuff is definitely only on the trunk, not even 3.x.

PeterKerk wrote:
> Hi Dennis,
>
> Good suggestion, but I see that most of that is Solr 4.0 functionality,
> which has not been released yet.
> How can I still use the longitude latitude functionality (LatLonType)?
>
> Thanks!
>    

RE: Re: Calculating distances in Solr using longitude latitude

Posted by Dennis Gearon <ge...@sbcglobal.net>.
You know, if there were some sort of hexagonal/pentagonal, soccer ball coordinate system for the Earth, all you'd need is an entry's distance to each of the 6/5 facets of the cell it was in, the distance between any two facets, and the distance to the endpoint to all it's facets. A giant table of precomputed distances, or some numbering system of coordinates that automatically gave the two facets and the distance between the faces would be even better.

Then just look up the distances and add them.

Still waiting for the coordinate system though :-). If one could get it to 10 meters resolution, wow.




Dennis Gearon

Signature Warning
----------------
EARTH has a Right To Life,
  otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Mon, 9/20/10, Markus Jelsma <ma...@buyways.nl> wrote:

> From: Markus Jelsma <ma...@buyways.nl>
> Subject: RE: Re: Calculating distances in Solr using longitude latitude
> To: solr-user@lucene.apache.org
> Date: Monday, September 20, 2010, 1:00 PM
> Hi,
> 
>  
> 
> In the early Solr 1.3 times we had an index with
> leisure-time objects that included geographical coordinates.
> Based on certain conditions we had to display a specific
> list of nearby objects. We simply implemented some Great
> Circle calculations such as the distance between points [1]
> and aggregated nearby objects and sent then to our index.
> The drawback is that for each addition to the index, you'd
> have to recalculate all other nearby objects, that takes a
> while. The good thing is, in production, the system isn't
> slowed down by these calculations so it's very fast.
> 
>  
> 
> [1]: http://williams.best.vwh.net/avform.htm#Dist

> 
>  
> 
> Cheers,
>  
> -----Original message-----
> From: Dennis Gearon <ge...@sbcglobal.net>
> Sent: Mon 20-09-2010 19:42
> To: solr-user@lucene.apache.org;
> 
> Subject: Re: Calculating distances in Solr using longitude
> latitude
> 
> Hmmm,
>     I am about to put a engineer on our search engine
> requirements with the assumption that latitude/longitude is
> available in the current release of Solr, (not knowing what
> that is). 
> 
>     I have been partitioning the whole Solr thing to
> him,except enough info for me to understand and interface to
> his work. Sooooooooo, I don't have that answer.
> 
>     Can someone else answer him?
> 
> 
> Dennis Gearon
> 
> Signature Warning
> ----------------
> EARTH has a Right To Life,
>  otherwise we all die.
> 
> Read 'Hot, Flat, and Crowded'
> Laugh at http://www.yert.com/film.php

> 
> 
> --- On Mon, 9/20/10, PeterKerk <ve...@hotmail.com>
> wrote:
> 
> > From: PeterKerk <ve...@hotmail.com>
> > Subject: Re: Calculating distances in Solr using
> longitude latitude
> > To: solr-user@lucene.apache.org
> > Date: Monday, September 20, 2010, 6:53 AM
> > 
> > Hi Dennis,
> > 
> > Good suggestion, but I see that most of that is Solr
> 4.0
> > functionality,
> > which has not been released yet.
> > How can I still use the longitude latitude
> functionality
> > (LatLonType)?
> > 
> > Thanks!
> > -- 
> > View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1529097.html

> > Sent from the Solr - User mailing list archive at
> > Nabble.com.
> > 
> 

RE: Re: Calculating distances in Solr using longitude latitude

Posted by Markus Jelsma <ma...@buyways.nl>.
Hi,

 

In the early Solr 1.3 times we had an index with leisure-time objects that included geographical coordinates. Based on certain conditions we had to display a specific list of nearby objects. We simply implemented some Great Circle calculations such as the distance between points [1] and aggregated nearby objects and sent then to our index. The drawback is that for each addition to the index, you'd have to recalculate all other nearby objects, that takes a while. The good thing is, in production, the system isn't slowed down by these calculations so it's very fast.

 

[1]: http://williams.best.vwh.net/avform.htm#Dist

 

Cheers,
 
-----Original message-----
From: Dennis Gearon <ge...@sbcglobal.net>
Sent: Mon 20-09-2010 19:42
To: solr-user@lucene.apache.org; 
Subject: Re: Calculating distances in Solr using longitude latitude

Hmmm,
    I am about to put a engineer on our search engine requirements with the assumption that latitude/longitude is available in the current release of Solr, (not knowing what that is). 

    I have been partitioning the whole Solr thing to him,except enough info for me to understand and interface to his work. Sooooooooo, I don't have that answer.

    Can someone else answer him?


Dennis Gearon

Signature Warning
----------------
EARTH has a Right To Life,
 otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Mon, 9/20/10, PeterKerk <ve...@hotmail.com> wrote:

> From: PeterKerk <ve...@hotmail.com>
> Subject: Re: Calculating distances in Solr using longitude latitude
> To: solr-user@lucene.apache.org
> Date: Monday, September 20, 2010, 6:53 AM
> 
> Hi Dennis,
> 
> Good suggestion, but I see that most of that is Solr 4.0
> functionality,
> which has not been released yet.
> How can I still use the longitude latitude functionality
> (LatLonType)?
> 
> Thanks!
> -- 
> View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1529097.html
> Sent from the Solr - User mailing list archive at
> Nabble.com.
> 

Re: Calculating distances in Solr using longitude latitude

Posted by Dennis Gearon <ge...@sbcglobal.net>.
Hmmm,
     I am about to put a engineer on our search engine requirements with the assumption that latitude/longitude is available in the current release of Solr, (not knowing what that is). 

     I have been partitioning the whole Solr thing to him,except enough info for me to understand and interface to his work. Sooooooooo, I don't have that answer.

     Can someone else answer him?


Dennis Gearon

Signature Warning
----------------
EARTH has a Right To Life,
  otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Mon, 9/20/10, PeterKerk <ve...@hotmail.com> wrote:

> From: PeterKerk <ve...@hotmail.com>
> Subject: Re: Calculating distances in Solr using longitude latitude
> To: solr-user@lucene.apache.org
> Date: Monday, September 20, 2010, 6:53 AM
> 
> Hi Dennis,
> 
> Good suggestion, but I see that most of that is Solr 4.0
> functionality,
> which has not been released yet.
> How can I still use the longitude latitude functionality
> (LatLonType)?
> 
> Thanks!
> -- 
> View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1529097.html
> Sent from the Solr - User mailing list archive at
> Nabble.com.
> 

Re: Calculating distances in Solr using longitude latitude

Posted by PeterKerk <ve...@hotmail.com>.
Hi Dennis,

Good suggestion, but I see that most of that is Solr 4.0 functionality,
which has not been released yet.
How can I still use the longitude latitude functionality (LatLonType)?

Thanks!
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1529097.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Calculating distances in Solr using longitude latitude

Posted by Dennis Gearon <ge...@sbcglobal.net>.
I woudn't do it in th browser.

Solr itself can give you both the buildings and the distance. 
http://wiki.apache.org/solr/SpatialSearch

Dennis Gearon

Signature Warning
----------------
EARTH has a Right To Life,
  otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Sun, 9/19/10, PeterKerk <ve...@hotmail.com> wrote:

> From: PeterKerk <ve...@hotmail.com>
> Subject: Calculating distances in Solr using longitude latitude
> To: solr-user@lucene.apache.org
> Date: Sunday, September 19, 2010, 8:04 AM
> 
> I want users to be able to filter buildings in my database,
> by enerting a
> random zipcode with a certain distance around it (in
> kilometers). 
> e.g.: 90210 with a radius of 50kilometer.
> 
> The longitude and latitude of a specific building are in
> the database.
> When the user searches on a zipcode, I can get the
> respective longitude and
> latitude from Google Maps.
> 
> Then in Solr I want to return all buildings from my
> database that are in the
> radius of the 50km with the entered zipcode as the
> center...
> 
> I checked this url for calculation, but not sure if there's
> any best
> practice on doing this...
> http://briancray.com/2009/04/01/how-to-calculate-the-distance-between-two-addresses-with-javascript-and-google-maps-api/
> 
> Any examples on how to do this?
> -- 
> View this message in context: http://lucene.472066.n3.nabble.com/Calculating-distances-in-Solr-using-longitude-latitude-tp1524297p1524297.html
> Sent from the Solr - User mailing list archive at
> Nabble.com.
>