Hi,

I tried for days to get the location module working.
I did all the admin settings and the nodetype settings. The admin settings are:

admin/settings/location
Use a Google Map to set latitude and longitude checked
admin/settings/location/maplinking
Google maps checked
admin/settings/location/geocoding
Set to Google Maps API
admin/settings/gmap_location
Enable the Google Map API geocoding: enabled

Gmap module with the gmap macro is working. And location is working on the profile pages.
But I can't get a node showing with a map!

I see with devel.module these records from location filled:

locations
Array
(
    [0] => Array
        (
            [eid] => 8
            [lid] => 3
            [type] => node
            [name] => House in Aquilas
            [street] => 
            [additional] => 
            [city] => Aguilas
            [province] => 
            [postal_code] => 
            [country] => es
            [latitude] => 37.403804
            [longitude] => -1.581161
            [source] => 3
            [is_primary] => 0
            [lat] => 37.403804
            [lon] => -1.581161
            [fax] => 
            [phone] => 
        )

)
location
Array
(
    [eid] => 8
    [lid] => 3
    [type] => node
    [name] => House in Aquilas
    [street] => 
    [additional] => 
    [city] => Aguilas
    [province] => 
    [postal_code] => 
    [country] => es
    [latitude] => 37.403804
    [longitude] => -1.581161
    [source] => 3
    [is_primary] => 0
    [lat] => 37.403804
    [lon] => -1.581161
    [fax] => 
    [phone] => 
)

I attach the look-and-feel I see.
Instead of the map I see:

Location(s)

I think this is a bug, is it?
If so, does anybody have a patch or solution. Maybe another setting I forgot?

Thanks in advance!
Greetings,
Martijn

Comments

summit’s picture

Category: bug » support
StatusFileSize
new24.84 KB

Hi,

I am able to show a link to a map now. It seems not all countries are supported by location...
How can I get the countries be supported? Google maps support the whole world right?

See attached picture. I can click on the link to go to google maps and see my map.
But what I really want..is to see the google map picture inside the node.
Is this possible please?

Above question I will set to support request. I think the link working is by design, right?

Greetings,
Martijn

summit’s picture

Hi,

After further investigation I can see that the link to the map is in: location.inc
Quote from another post:

The actual links are generated by the location_map_link function. 
The documentation for this functions says:
Get deep-links to a mapping services such as Yahoo! Maps or MapQuest (actual providers depend on configuration of location module) given a location. The call is delegated based on the 'country' value in the $location parameter.

The total code is:

function location_map_link($location = array(), $link_text = 'See map: ') {
  if (!isset($location['country']) && $location['country'] != 'xx') {
    return '';
  }

  $default_func = 'location_map_link_'. $location['country'] .'_default_providers';
  $providers_func = 'location_map_link_'. $location['country'] .'_providers';
  $providers = function_exists($providers_func) ? $providers_func() : array();
  $selected_providers = variable_get('location_map_link_'. $location['country'], function_exists($default_func) ? $default_func() : array());

  $links = array();
  foreach ($selected_providers as $mapper) {
    $link_func = 'location_map_link_'. $location['country'] .'_'. $mapper;
    if (function_exists($link_func)) {
      if ($link = $link_func($location)) {
        $links[] = '<a href="'. $link .'">'. $providers[$mapper]['name'] .'</a>';
      }
    }
  }
  if (count($links)) {
    return t($link_text) . implode($links, ", ");
  }
  else {
    return NULL;
  }
}

Could somebody please give me an alternative function in which I see the map itself and NOT the link to the map?
Thanks in advance!

Greetings,
Martijn

summit’s picture

Title: I can't get the map to show, please help » The map link is showing, but not the map itself (request)

Altered title after more investigation.
greetings,
Martijn

summit’s picture

Status: Active » Fixed

Hi,
I got it working, thanks to: http://drupal.org/node/181340

greetings,
Martijn

summit’s picture

This is my solution:

<?php 
      if ( ($location['latitude'] != 0) && ($location['longitude'] != 0) && ($teaser != 1) )
      {
        $homes=array('id' => 'outfittermap',
             'zoom' => 8,
             'width' => '300px',
             'height' => '200px',
             'type' => 'Map',
             'latitude' => $location['latitude'],
             'longitude'=> $location['longitude'],
             'markers' =>
               array( array('markername' => 'blue',
                     'latitude' => $location['latitude'],
                     'longitude' => $location['longitude']
               ))
        );
        
        $outfittermap = theme('gmap', array('#settings' => $homes));
        print $outfittermap;
      }
    ?>

Is this a correct solution to only get the nodes which have location information?
I think so, please respond with feedback.

thanks in advance,
greetings,
Martijn

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

ellanylea’s picture

Much appreciated, works for me!

Minor addition: to effectively set the map type, I had to use 'maptype' => 'Hybrid' (instead of 'type' => 'Hybrid')

This is with Drupal 5.7 and all latest modules of gmap, location, cck, views, etc. as of Mar. 14 2008.