To all interested here are suggested calculations ( I was planning on using this as a baseline):
http://www.meridianworlddata.com/HTML2/distance-formula-2.asp Thanks, Barry ----- Original Message ----- From: "Barry Volpe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, May 27, 2003 1:46 PM Subject: Re: [OT] Calculating distance using Longitude/Latitude > Micael, > > Thanks for your input. My problem is limited to how far one is willing > to travel to provide a service. The way I have it setup now is > one can specify up to five locations (cities). But if someone wants to > provide service to more than five cities they have no way of specifiying > this. It is a bit more cumbersome to specify individual cities. On the > other hand specifying a distance would require immediate feedback > to the person providing the service so they can realize what cities > they have specified (through distance). Another problem is > a city that is included in the distance may want to be excluded. > A solution that comes to mind is to allow the user to enter > the number of cities they want to provide service in. But what is > reasonable. 5, 10,100. That would be a pain in the neck to > enter and may utilize an unnecessary amount of the database > (would allow random cities not located adjacent to each other). > > > Barry > > > ----- Original Message ----- > From: "Micael" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Friday, May 23, 2003 5:20 PM > Subject: Re: [OT] Calculating distance using Longitude/Latitude > > > > Part of the answer is inevitably tied to your problem. If it is one kind > > of a problem, then distance is crucial. If it is another, then popluation > > is critical. Ten miles to a hotel in N.Y. is not ten miles to a hotel in > > the Mojave Desert. Know what I mean? Usually people approach these > > problems as distance problems when the actual area in which such solutions > > will usually be employed make them into topographical problems. I am not > > sure if that is relevant to you. If not, sorry for bothering you. Micael > > > > At 05:11 PM 5/23/03 -0700, you wrote: > > >At 16:10 -0700 5/23/03, Barry Volpe spoke thusly: > > > > > >>Hi, > > >> > > >>I don't know if there is anything particular to struts on this > subject.... > > >> > > >>What I want to do: > > >> > > >>I have a geo database with city,state and corresponding > longitude,lattitude. > > >>I want to allow a specific city/state location to be specified and a > > >>distance to > > >>be selected. Then all locations (in my database) within that distance > > >>(square miles I guess) > > >>can be displayed. > > >The equations, for the simple assumptions (see below) do not require more > > >then 10 lines of Java. You'd spend more time finding an implementation > > >than just coding you equations. > > > > > >The simple assumption is to compute a box around the source location with > > >sides equal to half the allowed distance. This will give you a min and > max > > >long and latitude that you could query against. Theoretically you should > > >check against a circle around your source point, so this will include too > > >many results in the query output. If you really need precision, you could > > >also computed the square inscribed within the circle and if query results > > >are inside the outer box, but outside the inner box, you could run > > >additional filtering in Java do to the precise calculation. > > >Off course the earth is not flat and the larger the distance, the more > > >error is introduced. Also, the circle above, is not really a circle for > > >the same reason. A possible modification is to compute the width of the > > >box (longitude) based on the latitude closest to the equator. This would > > >compensate for locations further away from the equator, but is still not > > >100% precise. > > >The trick, in the absence of even smarter approaches, is to do the quick > > >math such that it includes at least all known good answers, so you can do > > >some more filtering in code if necessary. > > > > > >--dolf > > > > > >--------------------------------------------------------------------- > > >To unsubscribe, e-mail: [EMAIL PROTECTED] > > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > LEGAL NOTICE > > > > This electronic mail transmission and any accompanying documents contain > > information belonging to the sender which may be confidential and legally > > privileged. This information is intended only for the use of the > > individual or entity to whom this electronic mail transmission was sent as > > indicated above. If you are not the intended recipient, any disclosure, > > copying, distribution, or action taken in reliance on the contents of the > > information contained in this transmission is strictly prohibited. If you > > have received this transmission in error, please delete the message. > Thank > > you > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

