Here is what I did :

1) installed location package 6.x-3.0
2) Installed latest gmap module 6.x-1.0
3) Added a location cck field to a node
4) Enabled geocoding for my country (switzerland)
5) Enabled gmap with google API (default map works and shows..)

Now I create a node with an adress, save the node and...

the map does not show. I enabled the block, and the block does not show, not does the node appear with a marker in the node locations page.

To me, everything seems in order, but still there is no map showing at all with that node.
Could anyone help!!

Thanks for such a cool module,

Patchak

CommentFileSizeAuthor
#19 location_cck.patch968 bytesrumburak
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

patchak’s picture

I just found that this happens only when using the cck field.

I'm using cck 2.1 for drupal 6 which is the latest version. Otherwise, on the "normal" location form, the bugs reported here do not happen.

Patchak

capellic’s picture

I am having the same issue with CCK fields. I am also using CCK 2.1

bdragon’s picture

Title: Map not showing at all » CCK fields not showing

Ahh, that would be becasue the node locations block doesn't know anything about cck locations.

capellic’s picture

So then how are we supposed to integrate GMAP into our nodes while using Location CCK fields? Am I missing something?

Per this feature request (http://drupal.org/node/347344), it's difficult to extract long/lat information from the $node object. Sure, I could us some grep, but that just doesn't seem right. ;-)

patchak’s picture

@Bdragon ; ahhhh I thought about that... It's not a "node" location, since it's a value from a cck field. I guess the idea here is to create a map view... will test that right now!!

Patchak

capellic’s picture

It's not a "node" location, since it's a value from a cck field. I guess the idea here is to create a map view... will test that right now!!

Did this work? If so, a "hack" is to pretend the view is a node view and allow an arg (nid) to be passed to it and then only display one. It takes a bit of themeing, but it can be done. Views 2 is so impressive that it has made me wish, more than once, that it also handled themeing for nodes.

patchak’s picture

Creating a map view does not work either, since passing the values to a gmap view from latitude and longitude fields is marked as TODO in the views interface.

Also, the fields are simply not available when trying to create a gmap view based on the cck field... So for the moment the only way to use this is to use the "direct" location that is not as a cck field...

@Bdragon : is fixing the cck field module on your short term list, cause I need to choose if I go with the normal location interface or the cck one and it depends a bit on if you think this is a priority or not... thanks a lot!!

Patchak

likewhoa’s picture

same issue here on drupal-6.8, map shows but markers are unavailable.

bdragon’s picture

Version: 6.x-3.0 » 6.x-3.x-dev

The map views should now be working in -dev, using a relationship. (I added relationship support to location_cck fields.)

sziggle’s picture

Component: Miscellaneous » Location_views

could someone supply a brief recipe for creating a views page with CCK location based markers on it?

using dev as of 1/23, i cannot get it to work. if i create a view of 'location' type, i don't see any relationships exposed that would help, and if i create a view of 'node' type, i cannot figure out what the right combination of relationship and fields are necessary to show a map with markers on it.

any help appreciated.

chazz’s picture

Still doesn't work even after -dev installation. Please check more info here - http://drupal.org/node/347091#comment-1217264

jastraat’s picture

Related? http://drupal.org/node/366880

You'd need to update all the existing CCK node fields in the location_instance table

rbl’s picture

Subscribing

SeanBannister’s picture

sub

pacesolutions’s picture

As per my installation I did not found any problems. Everything is working as it suppose to work. Here how you can work around the problem.

Packages:

- Latest Drupal - http://ftp.drupal.org/files/projects/drupal-6.10.tar.gz
- Latest Location Module - http://drupal.org/project/location (6.x-3.1-rc1)
- Latest GMap Module - http://drupal.org/project/gmap (6.x-1.1-rc1)

- Install or Upgrade to latest Drupal 6.10

- Download and place modules in the modules directory of your Drupal.

- Now activate the following modules from Administrator section (admin/build/modules)
* User Locations
* Node Locations
* Location Search
* Location
* GMap
* GMap Location

- Once modules are enabled. Get Google Maps API and configure the Location module (admin/settings/location).
* In Main settings tab, make sure you select United States as default country.
* Toggle location display: Enable
* Use a Google Map to set latitude and longitude is checked.
* Now in Geocoding Options tab, under United States choose Google Maps.
* Hit saves Configuration
* Now again under United States choose Configure Parameters (This is where you put your Google API key).

- Now configure GMap module (admin/settings/gmap).
* Put your API key here (If not already there.)
* Set default width & height as you like and choose also the default center (e.g.: 39.9434364619742,-77.2998046875), you can also configure more settings as you like.
* Now hit Save Configurations to save them.

- Now configure GMap Location (admin/settings/gmap_location)
* For each Macro put something like this: [gmap zoom=3 |center=39.9434364619742,-77.2998046875 |width=100% |height=300px |control=Small |type=Physical]

- Now most important part is to enable Location block in the content or sidebar to display the map correctly.
* Enable 'Location map' block (admin/build/block) and set to display in sidebar or content - now a small map will be displayed next to nodes that have a location.

- You can create a new content type or modify the existing to display and enter the location/map data. I will modify the default Page content type (admin/content/node-type/page)
* Under Locative Information click on Number of locations
* Set 1 for Minimum number of locations, Maximum number of locations and Number of locations that can be added at once.
* Under Collection Settings, choose the fields you want to display in the form for adding/editing.
* Now hit Save Content Type.

- Now create a new test page (node/add/page) to see if Google maps are working or not.
* Fill the details as you like,
* Double click on the map to place the marker and auto fill the Latitude & Longitude
* Save the Page node.

- You should be able to see the Google Map with marker in right place under your block. You can free place Location block anywhere as you like.

There is no need for CCK or any other module to work around. CCK module is not working.

Marko B’s picture

Priority: Normal » Critical

what why? cck module is not working? so we shouldnt even try to make use of location CCK to have google map. as most ppl would probably setup custom content type with cck filed for ggl map. it would be "nice" if maintenre had put a line over cck module and said its not working if its really not working (currently i get nothing when viewing node with location field) so we dont waist time :-(

tonycpsu’s picture

Subscribe

rumburak’s picture

Subscribe.
After testing I found out that the relationship betwwen the node and the location is broken. It seems the location_cck saves the info into the DB field genid of table location_instance (as "cck:field_location:2"). The views search for a relationship making a join on LEFT JOIN location_instance location_instance ON node.vid = location_instance.vid , but inside the location_instance.vid the value is 0. So the corret location is not found and so no information shown.
Anyone knows how to correct (force the insert of the correct vid inside the location_instance OR modify the join relationship for the views)?

rumburak’s picture

FileSize
968 bytes

Problem solved:
I modified the code of location_cck.module this way:
BEFORE:

    case 'update':
      // Store instances of locations by field name and vid.  
      $genid = 'cck:'. $field['field_name'] .':'. $node->vid;
      location_save_locations($items, array('genid' => $genid));
      // CCK automatically picks up the new lids and stores them in its own tables.
      break;

AFTER:

    case 'update':
      // Store instances of locations by field name and vid.
      $genid = 'cck:'. $field['field_name'] .':'. $node->vid;
      $tempvid = $node->vid;
      location_save_locations($items, array('genid' => $genid, 'vid' => $tempvid));
      // CCK automatically picks up the new lids and stores them in its own tables.
      break;

This correctly saves the vid inside the location_instance table so that views can find the correct location for CCK fields of location type.
Sorry i d

drupalok’s picture

do i have to uninstalle rc1 first or can i just update to dev version before applying this patch?

and will the "location block" work with this patch too? (at the moment it does not show node locations when saved to CCK)

thanks!

lolmaus’s picture

I've dug into the problem of missing map or missing marker on the map and found out the following. I hope this will be helpful.

There are two concurrent ways of assigning location to a node: via the 'Location' module and via the 'Location CCK' module. In the discussions of the problem, two ways are mixed and cause a lot of confusion.

Location CCK

The CCK way is THE WAY IT IS SUPPOSED TO BE DONE. But for now, only plain text coordinates display is implemented in the 'Location CCK' module. I don't know if they are going to develop a normal map display, but i hope they will.

How it works:
1) Enable the 'Location CCK' module.
2) Add a location field to your content type.
3) Go to Display Fields (admin/content/node-type//display) and select how the location should be presented to site visitors.

For now there are only two displays to choose from: show plain text coords and don't show location at all. I hope they will add a GMap-widget display soon.

Location (non-CCK)

This is the old-school way. It has no future because it is not based on the Views+CCK combination (which is THE approach in Drupal). Though, this method is developed enough for us to use it.

pacesolutions has posted a comprehensive guide how to use the non-CCK way to attach a location to a node:
http://drupal.org/node/346605#comment-1405790

Remove the CCK location field before trying it to make sure you use the correct place to enter location data.

Marko B’s picture

I guess you can theme location CCK in a way that u use text coords and add them to JS that calls google map and display map in that way, shouldnt be too hard to implement it that way.

mckeen_greg’s picture

I can confirm that this patch works. Thank you very much rumburak. :)

rumburak’s picture

Actually I made the patch on rc1, so I think it will work with no problem. Just in case you want to use it on dev version I think it would be safer to manually modify as indicated in the message instead of just using the patch.

rumburak’s picture

I think I will move onto patching so that CCK Location fields can show up as map. I just have to get more inside knowledge of drupal and its coding... However probably in a couple weeks or sooner I hope to have some results .

drupalok’s picture

does this patch work with multiple locations / cck fields per node?

YesCT’s picture

I think originally this was about why a cck location did not automatically appear on the location map. I think this is because the location map that comes with location only maps the "native" locations, not the cck locations.

Then, I think, a discussion began of how to get cck locations to show on a map: Using views to list the locations and a "map" display.

There is a patch that changes the way cck locations are saved in the database dealing with different id's. But it seems that is a work around/hack. And the right way is to have the "relationship" work.

I'm tagging, and hope to come back later and add in issue numbers.

arjunkr’s picture

Location block is not available in Admin-settings - Block , can anyone please guide me how to activate the location block to view the map.

YesCT’s picture

I think the blocks are views displays. Try looking in views.

arjunkr’s picture

Hai I Resolved this , was having prob with blocks...Thanks :)

dieter’s picture

subscribing

jontheil@gmail.com’s picture

Subscribing

bfdi533’s picture

I had the same problem and before finding this patch I had written a perl script to update the location_instance table with the nid and vid and scheduled it with cron. I like the patch version better.

schvili’s picture

Sorry, but since the patch from Rumburak seems to work, why not insert it to the Location module itself? Seems strange though to have to via the Relationship but better than not working at all.

Thank you, Rumburak!

lugha’s picture

Subscribing.

Question though, if I use Rumbarak's hack to have CCK update the nid/vid in location_instances, what will that effect down the road once the relationship is fixed and I start using modules that rely on CCK locations fields?

HnLn’s picture

subscribe

nodecode’s picture

subscribing.

izmeez’s picture

subscribe

nickl’s picture

Status: Active » Closed (duplicate)

Duplicate issue with working patch ready to be reviewed CCK/Views: location_instance fix

srobert72’s picture

Subscribing

mrgoltra’s picture

subscribing

notsoluckycharm’s picture

I discovered the end result of the patch myself... too bad I didn't stumble across this post.
I also like storing the NID, so I added 'nid' = $node->nid to it as well.