http://gmaps-samples-v3.googlecode.com/svn/trunk/drivingdirections/directions-demo.html

142 views
Skip to first unread message

tinem

unread,
Jun 20, 2010, 12:33:57 PM6/20/10
to Google Maps JavaScript API v3
First thanks for this great example using v3
http://gmaps-samples-v3.googlecode.com/svn/trunk/drivingdirections/directions-demo.html
but I want to know if there is something to do to solve the errors
after validating
http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fgmaps-samples-v3.googlecode.com%2Fsvn%2Ftrunk%2Fdrivingdirections%2Fdirections-demo.html,
please?

I want it to be as perfect as possible because I'm going to use it on
a Drupalsite http://www.tinemuller.dk/drupal/node/1156 and maybe tell
how it was done so some other drupaldesigners also can use it.



tinem

unread,
Jun 21, 2010, 3:11:26 AM6/21/10
to Google Maps JavaScript API v3
I have also copied the code and uploaded it as a "normal" site
http://www.tinemuller.dk/googlemaps_v3/directions_renderer/ but still
with errors.

I have changed
<script type="text/javascript" src="http://maps.google.com/maps/api/js?
sensor=false&amp;key=ABQIAAAAOZJQqoDBwAknMtPNKR-
dvRSi2OoyjRwg8X5jAJmNj4togrBv2xSClpdvpd4FJNt4C5i-i6aTtWzs-g"></script>
to
<script src="http://maps.google.com/maps/api/js?sensor=true"
type="text/javascript"></script>

Is that correct? I have seen this code made a lot of others ways but
want to know if this is the CORRECT, please?

Pil

unread,
Jun 21, 2010, 5:38:55 AM6/21/10
to Google Maps JavaScript API v3


On Jun 21, 9:11 am, tinem <ti...@email.dk> wrote:

> <script src="http://maps.google.com/maps/api/js?sensor=true"
> type="text/javascript"></script>


That should be correct - if you need the sonsor parameter set to true,
otherwise set it to false.

You should only have to add a valid doctype declaration at the first
example.

I agree with your intention because it's unbelievable that most (if
not all) v3 examples have no doctype declaration. They are therefore
misleading people to use invalid html.

tinem

unread,
Jun 21, 2010, 8:19:18 AM6/21/10
to Google Maps JavaScript API v3
I have send an e-mail private to Daniel Lee which has made this great
example and hopefully he will join the forum and answer.

In the meanwhile i cleaned up and changed some things and also
included a Doctype and now it's validating
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.tinemuller.dk%2Fgooglemaps_v3%2Fdirections_renderer%2Fdoctype_index.html&charset=%28detect+automatically%29&doctype=Inline&group=0&verbose=1&user-agent=W3C_Validator%2F1.781
with my file http://www.tinemuller.dk/googlemaps_v3/directions_renderer/doctype_index.html.

But hopefully Daniel will make these changes to his example file for
people to download if he AGREES?

I also need someone so explain to me when to use sensor=true og
sencor=false and if there is some more to use because I don't
understand all this, sorry. :-(

Pil

unread,
Jun 21, 2010, 9:13:17 AM6/21/10
to Google Maps JavaScript API v3


On Jun 21, 2:19 pm, tinem <ti...@email.dk> wrote:

> http://www.google.com/url?sa=D&q=http://www.tinemuller.dk/googlemaps_v3/directions_renderer/doctype_index.html&usg=AFQjCNEmAbmM9ezrgBDrOLD63ysSO9-T5A

Looks good, only the container for the map is missing, so a script
error will be reported. You only have to add

<div id="map-container"></div>

The sensor parameter is used to determine the users location. It's
documented here

http://code.google.com/apis/maps/documentation/javascript/basics.html#SpecifyingSensor

tinem

unread,
Jun 23, 2010, 7:43:02 AM6/23/10
to Google Maps JavaScript API v3
Thanks Pil for your feedback.

Does it mean that if I use it for a normal map like this I use "false"
and if I use it on a GPS it should be "true"?

I have been going a step further and made external css like this
http://www.tinemuller.dk/googlemaps_v3/directions_renderer/directions_renderer.css
and it's functioning great but then I would also like to have
javascript in it's own file http://www.tinemuller.dk/googlemaps_v3/directions_renderer/directions_renderer.js
but get an error in Firebug -

Demo.fromInput is null
http://www.tinemuller.dk/googlemaps_v3/directions_renderer/directions_renderer.js
Line 49?

Can I not make it like this or can you help with the error, please?

I also got my code to work and validate in Drupal http://www.tinemuller.dk/drupal/node/1156
but haven't used external .js here only .css. :-)

/Tine




Rossko

unread,
Jun 23, 2010, 8:16:24 AM6/23/10
to Google Maps JavaScript API v3
> Does it mean that if I use it for a normal map like this I use "false"
> and if I use it on a GPS it should be "true"?

Almost. What counts is if you intend to USE the GPS position somewhere
in the map, like setting the initial centre.

tinem

unread,
Jul 1, 2010, 10:24:15 AM7/1/10
to Google Maps JavaScript API v3
Got it to functioning. Interested could read more about it here
http://groups.google.nu/group/google-maps-js-api-v3/browse_thread/thread/0f2d4398ff61c586#
Reply all
Reply to author
Forward
0 new messages