Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

javascript display [object]


  • Please log in to reply

#1
Metallica

Metallica

    Spyware Veteran

  • GeekU Moderator
  • 31,672 posts
Hi all,

A simple question in essence I think.

I'm trying to compare real routes to Google directions.
The maps are not the problem, but I'm trying to compare the real distance to the one from the routing as well and that doesn't work.
I suspect the export to be of a different type then what I need.

The product of my php program can be seen here:

http://www.pieter-ar...t/dagroute.html

The blue line is the Google directions, the red line is how our driver really went (well, actually straight lines between points taken every 15 minutes)
On the right you'll see the problem. First the difference between km start and km stop is what the driver really needed.
Then Google distance = [object]

I'll appreciate any nudge in the right direction. :)
  • 0

Advertisements


#2
Johanna

Johanna

    The Leather Lady

  • Moderator
  • 3,038 posts
I'm getting an error when I click on your link, then I do not see your map.
Johanna

Attached Thumbnails

  • ScreenShot080.jpg

  • 0

#3
Metallica

Metallica

    Spyware Veteran

  • Topic Starter
  • GeekU Moderator
  • 31,672 posts
Fixed.

I left in the key for the Intranet. :)

The php script checks where the request comes from and inserts the correct key.
I forgot to replace it when I copied the source.
  • 0

#4
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts
I would think your sample rate needs to be better then 15 minutes apart to get a closer approximation to Google's map. Notice the departure point for Calais where your route goes directly across and does not follow the jog left before leaving to Calais. This may be because of the longer sample rate at that time producing erroneous positioning.

Ron

Edited by Major Payne, 07 November 2007 - 01:47 PM.

  • 0

#5
Metallica

Metallica

    Spyware Veteran

  • Topic Starter
  • GeekU Moderator
  • 31,672 posts
Hi Ron,

In the Eurotunnel the samples can't be taken, so they are farther apart.
For normal circumstances they should be sufficient though.
Thanks for looking. :)

Regards,
  • 0

#6
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts
Could you not set to run an approximation program for those intervals based on prior/later data during times the Eurotunnel samples should be taken? Maybe integrate the data with smaller sample rates to get a closer approximation during those times?

Was there a tunnel at the sample points where it departs Calais? If not, then the samples rates are too long.

Ron

Edited by Major Payne, 07 November 2007 - 02:43 PM.

  • 0

#7
Metallica

Metallica

    Spyware Veteran

  • Topic Starter
  • GeekU Moderator
  • 31,672 posts
Hi Ron,

We only need the red line to find where the drivers didn't follow Googles "ideal route"
(Most of the time they outperform it)
The Eurotunnel is the tunnel under the English Channel where the trucks are transported by train.
They will be under the surface and out of reach for approximately an hour.

We also have to consider the amount of data. We have about 50 trucks equipped with this system.
Sampling them every few minutes would create an awfull workload. :)
  • 0

#8
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts
OK. Didn't know these restrictions with the routes. Thought you were just running an exercise to get something developed. Not sure, but there may be a data compression algorithm you may use to allow for shorter data rates. For tunnel or similar obstructions, I think data sampling could be turned off for those periods of time possibly triggered by loss/reacquisition of signal and the data for the route from Google used instead for those times.

Interesting problem though.

Ron
  • 0

#9
Metallica

Metallica

    Spyware Veteran

  • Topic Starter
  • GeekU Moderator
  • 31,672 posts
It is actually just a new feature I wanted to add to an existing program we are using to keep track of our trucks.

*Metallica thinks the error is in here:

<script type="text/javascript">document.write('Afstand volgens Google = ');
	document.write(distance);</script></div>

where distance probably is a different kind of object then I was expecting.
I just don't know enough javascript to figure out what it is and how to get it displayed.
  • 0

#10
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts
I'm not much with JS either so can't help there. There is a way to set up a function that computes and returns the distance between two points, but how to get it to actually function the way it should is beyond me. If you have some idea of how to use it, this is a basic way of doing it:

{
var dx = x2 - x1;
var dy = y2 - y1;
return Math.sqrt(dx*dx + dy*dy);
}

Google does have a lot of additional coding you can tie into their maps to make them highly functional. Was reading some of their set up one day and just got a big headache. :)

Ron

Edited by Major Payne, 08 November 2007 - 03:14 AM.

  • 0

#11
Metallica

Metallica

    Spyware Veteran

  • Topic Starter
  • GeekU Moderator
  • 31,672 posts

just got a big headache. :)


Probably the same I have now. :)
  • 0

#12
Metallica

Metallica

    Spyware Veteran

  • Topic Starter
  • GeekU Moderator
  • 31,672 posts
Progress :)

Thanks to the site of the Blackpool Community Church Javascript Team I found a way to calculate and display the sum of the distances for the steps in the directions.

http://www.pieter-ar.../dagroute4.html

Now all I have to do is integrate the two.

Next headache coming up
  • 0

#13
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts
Good luck. BTW, I still have plenty of aspirin left over. Bought the Industrial size container: 55 gallon drum's worth. :)

Ron
  • 0

#14
Metallica

Metallica

    Spyware Veteran

  • Topic Starter
  • GeekU Moderator
  • 31,672 posts
Got it. :)

Above link works.
Now all I have to do is the PHP script to feed the proper data to the script.
Piece of cake.

Thanks for everyone that rread and tried to help here. :)
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP