Hi Simon,

The calculation should work nicely for you. Please not my other post
though - I think decimal place rounding should be increased from 3 to
15 to get better results.

Gavin.

On Jun 28, 9:17 am, "Simon Haddon" <[EMAIL PROTECTED]> wrote:
> Hi Taco,
>
> Out of interest, what are you building.  I need to add distance calculations
> (in the future) to a temporal/spatial mapping interface I have just finished
> buildinghttp://www.nams.gov.au/index.cfm?fa=mui.run.
>
> Cheers,
> Simon
>
> On 26/06/07, Taco Fleur <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Just got the solution to this, it had to do with rounding. Beats me why,
> > but thats what it was anyways.
> > Thanks for helping.
>
> > SET
> > @distance = ( ROUND ( ( ACOS( ROUND( ( SIN( @fromLatitude / 57.2958) * SIN
> > ( @toLatitude / 57.2958 ) )
>
> > +
> > ( COS( @fromLatitude / 57.2958 ) * COS ( @toLatitude / 57.2958 ) * 
> > COS(@toLongitude
> > / 57.2958 - @fromLongitude / 57.2958 ) ), 3) ) ) * 6378.135, 3) )
>
> > On 6/26/07, Scott Thornton <[EMAIL PROTECTED]> wrote:
>
> > > Would you mind posting the formula? also reformatting the code with
> > > tab's?
>
> > > round(
> > >   ACOS(
> > > )
> > > ,3)
>
> > > I have been playing around with it and got it to work but I am not sure
> > > if it what was intended as I mucked around with the brackets. There seemed
> > > to be spare brackets about.
>
> > > >>> "Taco Fleur" < [EMAIL PROTECTED]> 26/06/2007 12:40 pm >>>
> > > OK, I've narrowed it down to the following code and values. I also see
> > > that
> > > other people have had the same problem, no answers listed in the forums
> > > though.
>
> > > The offending code is;
>
> > > DECLARE @fromLatitude AS REAL
>
> > > , @fromLongitude AS REAL
>
> > > , @toLatitude AS REAL
>
> > > , @toLongitude AS REAL
>
> > > SET @fromLatitude = -31.111695
>
> > > SET @fromLongitude = 117.792134
>
> > > SET @toLatitude = -31.111695
>
> > > SET @toLongitude = 117.792134
>
> > > DECLARE @distance REAL
>
> > > SET @distance = ( ROUND( ( ACOS( ( SIN( @fromLatitude / 57.2958 ) *
> > > SIN(@toLatitude
> > > / 57.2958 ) ) +
>
> > > ( COS ( @fromLatitude / 57.2958 ) * COS( @toLatitude / 57.2958 ) *
> > > COS(@toLongitude
> > > /57.2958 - @fromLongitude / 57.2958 ) ) ) ) * 6378.135, 3 ) )
>
> > > SELECT @distance;
>
> > > On 6/26/07, Scott Thornton < [EMAIL PROTECTED]> wrote:
>
> > > > could it be related to:
>
> > > >http://www.sql-server-performance.com/faq/sqlviewfaq.aspx?faqid=208
>
> > > > but then you mentioned it runs ok on the database itself.
>
> > > > >>> "Taco Fleur" < [EMAIL PROTECTED]> 26/06/2007 11:57 am >>>
> > > > Hello all,
>
> > > > I am getting the following error "A domain error occurred"
> > > > [Macromedia][SQLServer JDBC Driver][SQLServer]A domain error occurred.
>
> > > > The cfquery tag is calling a stored procedure, and when I call that
> > > > procedure directly on the database with the same values there appears
> > > to
> > > > be
> > > > no problem.
>
> > > > So, I;m guessing it has something to do with the driver? Has anyone
> > > seen
> > > > this before?
> > > > Any help or hints will be much appreciated.
>
> > > > --
> > > >http://www.clickfind.com.au
> > > > The new Australian search engine for businesses, products and services
>
> > > --
> > > *** { . } { . } ****
> > >http://www.clickfind.com.au
> > > The new Australian search engine for businesses, products and services
>
> > >http://www.clickfind.com.au
> > > The new Australian search engine for businesses, products and services
>
> --
> Cheers
> Simon Haddon


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to