I installed this very nice module and all worked fine.

After setting up my first direction I got shown the directions listed
but where the map should appear there is a blank field with the
dimensions of the map and it say’s “Javascript is required to view
this map.”
I verified that I have javascript enabled on my browser (other gmaps
are shown without any problem) I searched a while and could find out
that the data for the map is filled in after the the call for the map
in source code on the website it looks like this

<div style="width: 100%; height: 600px;" 
     id="gmap-my-map-gmap0" 
     class="gmap-control gmap-gmap gmap gmap-map gmap-my-map-gmap gmap-processed">
     Javascript is required to view this map.
</div>

And then comes

<script type="text/javascript">
/* <![CDATA[ */ jQuery.extend(true, Drupal, { settings: { "gmap": { "my-map": {"width":"100%", "height": "600px", "zoom": 10, "maxzoom": "14", "controltype":
"Small", "align": "None", "maptype": "Map", "mtc": "standard","baselayers":{ "Map": 1, "Satellite": 1, "Hybrid": 1 }, "styles": { "line_default":
["0000ff", "5", "45", "", "" ], "poly_default": [ "000000", "3", "25", "ff0000", "45" ] }, "line_colors": [ "#00cc00", "#ff0000", "#0000ff" ],
"behavior": { "locpick": false, "nodrag": 0, "nokeyboard": 1, "nomousezoom": 0, "nocontzoom": 0, "autozoom": 0, "dynmarkers": 0, "overview": 0,
"collapsehack": 0, "scale": 0 }, "markermode": "1", "id": "my-map", "latitude": "51.9836", "longitude": "7.8852", "shapes": [ { "type": "line",
"points": [ [ "52.0059", "7.90506" ], [ "52.004", "7.90468" ],  ....  more data  .....  [ "51.9642", "7.86181" ], [ "51.9638", "7.86046" ], [ "51.9637", 
"7.85994" ], [ "51.9637", "7.8597" ] ], "style": [ "ff0000", 5, 80, "00ff00", 60 ] } ] } } } });
/* ]]*/
</script>

JavaScript is definitely turn on in my browser because other JavaScript functions work without any problem

What is wrong on my site
Thanks for any help in advance

Georg

Comments

jurgenhaas’s picture

When viewing a map in gmap_direx, the module write the following content into the page:

<h3>From "xyz" to "abc" </h3>
<ul>
<li>
... instructions ...
</li>
</ul>
<div style="width: 100%; height: 600px;" id="gmap-my-map-gmap0" class="gmap-control gmap-gmap gmap gmap-map gmap-my-map-gmap">Javascript is required to view this map.</div>

After the page got loaded, the JavaScript in gmap.js (which comes from the GMap module and is not ours) finding the id gmap-my-map-gmap0 and replaces and loads the corresponding map from Google and replaces the text "Javascript is required to view this map." by the map itselve.

So, if the text remains visible, it means that the module Gmap is doing something wrong.

gording’s picture

Hi jurgenhass,

I verified that the gmap.js is loaded within the header.

the following script files are loaded

  <script type="text/javascript" src="/misc/jquery.js?k"></script>
<script type="text/javascript" src="/misc/drupal.js?k"></script>
<script type="text/javascript" src="/sites/default/files/languages/de_1806b329f67d22ae73ca00863589a3e1.js?k"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/gmap.js?k"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/marker.js?k"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/gmarkermanager_marker.js?k"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/poly.js?k"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/shapeloader_static.js?k"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/gmap_shapes.js?k"></script>

so as you explained it has to be thomthing else.

Thanks for your help

Georg

jurgenhaas’s picture

It's probably a good guess that the GMap module isn't configured properly. E.g. have you defined your Google Maps API key? Are you seeing a map when you're going to admin/settings/gmap on your site? The system is using the exact same syntax to display a map which is described in #1 above.

gording’s picture

Hallo jurgenhass

yes I did set up the google maps api key, and as well the map is showing up on the settings page and on other pages where I show maps like content location, user location and so on.

So this is what I wonder about why the map is not displayed but I´m getting a bit closer. I tryed to put out a gmap macro in to your code to see if this map will be displayed. So I put this code at line 140 in to your code and tryed what happen

function gmap_direx_view($user, $rid) {
  include_once('gmap_direx.route.inc');
  $route = new Gmap_Direx_Route($rid);
  if (!$route->valid) {
    drupal_not_found();
    return;
  }
#####  new line for gmap macro   ###### 
  $static_map = "[gmap circle=52.30267945395412 , 7.668365836143494 + 0 |circle=52.30262696931209 , 7.668355107307434 + 0 |circle=52.30261384814185 , 7.6684945821762085 + 0.07188798118970123 |zoom=14 |center=52.29966148598202,7.668542861938477 |width=600px |height=200px |control=Small |type=Satellite]";</b>
  

  return '<h4>'. $route->name .'</h4>'. ####  implent gmap into output  ####  $static_map    ####  . $route->explanation() . $route->map();
}

but still no map that meens you are right that the map is not coded via js but question now is why because the gmap js is loaded in the head

<script type="text/javascript" src="/sites/all/modules/gmap/js/gmap.js?m"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/marker.js?m"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/gmarkermanager_marker.js?m"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/poly.js?m"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/shapeloader_static.js?m"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/gmap_shapes.js?m"></script>

and that means that as well the gmap macro should be displayed on this side or am I wrong here

Georg

jurgenhaas’s picture

Project: GMap Direction Extras » GMap Module
Version: » 6.x-1.x-dev

I'm note sure this is a gmap_direx issue. This module write the same code into html as the gmap module does itselve by using the theme("gmap") function and hopefully someone from the gmap module is able to help us here to find out why this is misinterpreted in your website where it works perfectly fine at others.

Therefore I've assigned this to the gmap module issue queue asking for help.

gording’s picture

Thanks for your help,

would you have a site for me where I can see a working version

jurgenhaas’s picture

Please go to http://www.paragon-es.de and login as stormdashboarddemo with the password being the last 4 characters of the username.

gording’s picture

Hallo jurgenhaas

thanks for the login I found the working version on your site. There are a few js files which are not on my site I´m going to find out if this is the reason why my map is not displayed.

As son as I have any result I will let you know.

Georg

johnv’s picture

Status: Active » Closed (won't fix)

Closing this very old issue. Please reopen if it is still valid.